适用于:✔️ Linux 虚拟机 ✔️ Windows 虚拟机 ✔️ 虚拟机 Flex 规模集
托管映像是通用化和捕获虚拟机映像的旧方法。 对于最新的技术,建议客户使用 Azure Compute Gallery。 只有通过 Azure Compute Gallery,才支持所有新功能(如 ARM64、受信任启动和机密虚拟机)。 如果已有托管映像,可将其用作源并创建 Azure Compute Gallery 映像。
将托管映像迁移到 Azure Compute Gallery 映像
本部分分步介绍如何使用 Azure 门户将托管映像迁移到现有的 Azure Compute Gallery。
- 登录到 Azure 门户。
- 导航到要迁移的
Managed image
,然后选择“克隆到 VM 映像”。
在 Create VM image version
页上提供以下详细信息,然后选择“下一步: 复制 >”:
- 版本号
- 目标 Azure Compute Gallery
- 目标虚拟机映像定义
选择以下 Replication
配置或选择默认值,然后选择“下一步: 加密 >”:
选择 SSE encryption type
或选择默认 Encryption at-rest with a platform managed key
,然后选择“下一步: 标记 >”。
(可选)分配资源标记。
在 Review + Create
页上验证配置,然后选择“创建”完成迁移。
需要源映像的 tenantID
、用于 Azure Compute Gallery(目标)的 subscriptionID
以及源映像的 resourceID
。
# Set some variables
tenantID="<tenant ID for the source image>"
subID="<subscription ID where the image will be creted>"
sourceImageID="<resource ID of the source managed image>"
# Login to the subscription where the new image will be created
az cloud set -n AzureChinaCloud
az login
# Log in to the tenant where the source image is available
az login --tenant $tenantID
# Log back in to the subscription where the image will be created and ensure subscription context is set
az login
az account set --subscription $subID
# Create the image
az sig image-version create `
--gallery-image-definition myImageDef `
--gallery-image-version 1.0.0 `
--gallery-name myGallery `
--resource-group myResourceGroup `
--image-version $sourceImageID
需要源映像的 tenantID
、用于 Azure Compute Gallery(目标)的 subscriptionID
以及源映像的 resourceID
。
# Set variables
$targetSubID = "<subscription ID for the target>"
$sourceTenantID = "<tenant ID where for the source image>"
$sourceImageID = "<resource ID of the source image>"
# Login to the tenant where the source image is published
Connect-AzAccount -Tenant $sourceTenantID -UseDeviceAuthentication
# Login to the subscription where the new image will be created and set the context
Connect-AzAccount -AzureEnvironmentName AzureChinaCloud -UseDeviceAuthentication -Subscription $targetSubID
Set-AzContext -Subscription $targetSubID
# Create the image version from another image version in a different tenant
New-AzGalleryImageVersion `
-ResourceGroupName myResourceGroup `
-GalleryName myGallery `
-GalleryImageDefinitionName myImageDef `
-Location "China North 2" `
-Name 1.0.0 `
-SourceImageId $sourceImageID
将托管映像引用替换为虚拟机和 Flex 规模集部署模板中的 Azure Compute Gallery 映像版本。