适用于:✔️ Linux VM ✔️ Windows VM ✔️ 灵活规模集 ✔️ 统一规模集
Azure Compute Gallery(以前称为共享映像库)的映像存储为快照。 These images are automatically encrypted through server-side 256-bit encryption AES encryption. 服务器端加密也符合 FIPS 140-2 规范。 有关加密模块基础 Azure 托管磁盘的详细信息,请参阅加密 API:下一代。
可以使用平台管理的密钥加密映像,也可以使用你自己的密钥。 还可以结合使用这两项功能进行双重加密。 如果你选择管理使用自己的密钥进行的加密,可以指定客户管理的密钥,用于加密和解密映像中的所有磁盘。
通过客户管理的密钥进行的服务器端加密使用 Azure Key Vault。 You can generate new RSA keys in Azure Key Vault.
先决条件
本文要求你已在要复制映像的每个区域中设置了磁盘加密:
若只使用客户管理的密钥,请参阅那些介绍如何使用 Azure 门户或 PowerShell 为客户管理的密钥启用服务器端加密的文章。
若要同时使用平台管理的密钥和客户管理的密钥(进行双重加密),请参阅那些介绍如何通过 Azure 门户或 PowerShell 启用静态双重加密的文章。
重要
You must use the link https://portal.azure.cn/?feature.enabledoubleencryption=true&feature.enablehostbasedencryption=true#home to access the Azure portal. “静态双重加密”目前不会显示在公共 Azure 门户中,除非你使用该链接。
局限性
使用客户管理的密钥加密 Azure Compute Gallery 中的映像时存在以下限制:
加密密钥集必须与映像位于同一订阅中。
加密密钥集是区域资源,因此每个区域都需要不同的加密密钥集。
使用自己的密钥加密映像后,不能重新改用平台管理的密钥来加密这些映像。
使用 CMK 加密的 ACG 映像版本源不能用作创建另一个 ACG 映像版本的源。
门户中不支持某些功能,例如复制 SSE+CMK 映像、从 SSE+CMK 加密磁盘创建映像等。
创建映像
若要指定映像版本的磁盘加密集,请将 New-AzGalleryImageVersion 与 -TargetRegion
参数配合使用:
$sourceId = <ID of the image version source>
$osDiskImageEncryption = @{DiskEncryptionSetId='subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/diskEncryptionSets/myDESet'}
$dataDiskImageEncryption1 = @{DiskEncryptionSetId='subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/diskEncryptionSets/myDESet1';Lun=1}
$dataDiskImageEncryption2 = @{DiskEncryptionSetId='subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/diskEncryptionSets/myDESet2';Lun=2}
$dataDiskImageEncryptions = @($dataDiskImageEncryption1,$dataDiskImageEncryption2)
$encryption1 = @{OSDiskImage=$osDiskImageEncryption;DataDiskImages=$dataDiskImageEncryptions}
$region1 = @{Name='China North';ReplicaCount=1;StorageAccountType=Standard_LRS;Encryption=$encryption1}
$ChinaEast2osDiskImageEncryption = @{DiskEncryptionSetId='subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/diskEncryptionSets/myChinaEast2DESet'}
$ChinaEast2dataDiskImageEncryption1 = @{DiskEncryptionSetId='subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/diskEncryptionSets/myChinaEast2DESet1';Lun=1}
$ChinaEast2dataDiskImageEncryption2 = @{DiskEncryptionSetId='subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/diskEncryptionSets/myChinaEast2DESet2';Lun=2}
$ChinaEast2DataDiskImageEncryptions = @($ChinaEast2dataDiskImageEncryption1,$ChinaEast2dataDiskImageEncryption2)
$encryption2 = @{OSDiskImage=$ChinaEast2osDiskImageEncryption;DataDiskImages=$ChinaEast2DataDiskImageEncryptions}
$region2 = @{Name='China East 2';ReplicaCount=1;StorageAccountType=Standard_LRS;Encryption=$encryption2}
$targetRegion = @($region1, $region2)
创建映像
New-AzGalleryImageVersion `
-ResourceGroupName $rgname `
-GalleryName $galleryName `
-GalleryImageDefinitionName $imageDefinitionName `
-Name $versionName -Location $location `
-SourceImageId $sourceId `
-ReplicaCount 2 `
-StorageAccountType Standard_LRS `
-PublishingProfileEndOfLifeDate '2020-12-01' `
-TargetRegion $targetRegion
创建 VM
可以从 Azure Compute Gallery 创建虚拟机 (VM),并使用客户管理的密钥来加密磁盘。 语法与从映像创建通用化或专用化 VM 相同。 请使用扩展的参数集并将 Set-AzVMOSDisk -Name $($vmName +"_OSDisk") -DiskEncryptionSetId $diskEncryptionSet.Id -CreateOption FromImage
添加到 VM 配置。
后续步骤
详细了解服务器端磁盘加密。
有关如何提供购买计划信息的信息,请参阅在创建映像时提供 Azure 市场购买计划信息。