我的Azure帐户中有一个16.04-LTS Ubuntu虚拟机,我正在尝试Azure Disk Encryption
使用this azure cli sample script这个虚拟机。在运行加密脚本时,azure门户显示其操作系统磁盘已加密。加密标题下有Enabled
。
但是,用于获取有关虚拟机的信息的Azure REST API(api link)不会返回encryptionSettings
下的properties.storageProfile.osDisk
。我为api-version Model View
以及Model View and Instance View
尝试了2017-03-30
和2017-12-01
。以下是API的部分响应:
{
"name": "ubuntu",
"properties": {
"osProfile": {},
"networkProfile": {},
"storageProfile": {
"imageReference": {
"sku": "16.04-LTS",
"publisher": "Canonical",
"version": "latest",
"offer": "UbuntuServer"
},
"osDisk": {
"name": "ubuntu-OsDisk",
"diskSizeGB": 30,
"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "..."
},
"caching": "ReadWrite",
"createOption": "FromImage",
"osType": "Linux"
},
"dataDisks": []
},
"diagnosticsProfile": {},
"vmId": "",
"hardwareProfile": {
"vmSize": "Standard_B1s"
},
"provisioningState": "Succeeded"
},
"location": "eastus",
"type": "Microsoft.Compute/virtualMachines",
"id": ""
}
但是对于我的其他加密的Windows虚拟机,我得到了encryptionSettings
中包含properties.storageProfile.osDisk
的正确回复:
{
"name": "win1",
"properties": {
"osProfile": {},
"networkProfile": {},
"storageProfile": {
"imageReference": {
"sku": "2016-Datacenter-smalldisk",
"publisher": "MicrosoftWindowsServer",
"version": "latest",
"offer": "WindowsServer"
},
"osDisk": {
"name": "win1_OsDisk_1",
"diskSizeGB": 31,
"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "..."
},
"encryptionSettings": {
"diskEncryptionKey": {
"secretUrl": "...",
"sourceVault": {
"id": "..."
}
},
"keyEncryptionKey": {
"keyUrl": "...",
"sourceVault": {
"id": "..."
}
},
"enabled": true
},
"caching": "ReadWrite",
"createOption": "FromImage",
"osType": "Windows"
},
"dataDisks": []
},
"diagnosticsProfile": {},
"vmId": "...",
"hardwareProfile": {
"vmSize": "Standard_B1s"
},
"provisioningState": "Succeeded"
},
"location": "eastus",
"type": "Microsoft.Compute/virtualMachines",
"id": "..."
}
为什么虚拟机Get API没有为某些VM返回encryptionSettings
?任何帮助将不胜感激。
答案 0 :(得分:0)
我使用以下命令创建VM。
az vm create \
--resource-group shuivm \
--name shuivm \
--image Canonical:UbuntuServer:16.04-LTS:latest \
--admin-username azureuser \
--generate-ssh-keys
当我使用以下API时,我可以进行加密设置。
https://management.azure.com/subscriptions/**********/resourceGroups/shuivm/providers/Microsoft.Compute/virtualMachines/shuivm?api-version=2017-03-30"
注意:当OS加密成功时,我可以使用API来获取加密设置。
答案 1 :(得分:0)
这是因为Azure VM有两种类型的静态磁盘加密,并且它们未在Azure Management API的同一部分中报告:
请参阅:https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineextensions/list