是否可以将使用azure色标度集的azure色pipe理的磁盘作为操作系统磁盘使用

是否可以使用pipe理磁盘来设置虚拟机的比例。 我正在尝试vmss vmconfiguration文件,但不断收到错误

"virtualMachineProfile": { "storageProfile": { "imageReference": { "publisher": "Canonical", "offer": "UbuntuServer", "sku": "14.04.2-LTS", "version": "14.04.2-LTS" }, "osDisk": { "osType": "Linux", "caching": "ReadWrite", "createOption": "FromImage", "name": "OSDisk", "managedDisk": { "storageAccountType": "Premium_LRS" } }, "dataDisks": [ { "lun": 0, "managedDisk": { "id": "[resourceId('Microsoft.Compute/disks', 'testvm_OsDisk_1_bac5bcaf20ec4cafbb0f452d631fe68f')]" }, "caching": "None", "createOption": "Attach" } ] }, message": "Parameter 'osDisk.managedDisk.id' is not allowed. 

不要给你的osdisk一个名字,例如osdisk:

  "storageProfile": { "osDisk": { "createOption": "FromImage", "caching": "ReadWrite" }, "imageReference": "[variables('imageReference')]"" }, 

例如数据磁盘:

  dataDisks": [ { "diskSizeGB": "[variables('sizeOfDiskInGB')]", "lun": 0, "createOption": "Empty" } ], }, 

目前,我们无法直接使用托pipe磁盘来创buildAzure虚拟机。
但是我们可以通过PowerShell创build托pipevm或快照的托pipe映像,然后我们可以使用这个新映像来创buildazure色虚拟机。

 $vmName = "myVM" $rgName = "myResourceGroup" $location = "EastUS" $imageName = "myImage" Stop-AzureRmVM -ResourceGroupName $rgName -Name $vmName -Force Set-AzureRmVm -ResourceGroupName $rgName -Name $vmName -Generalized $vm = Get-AzureRmVM -Name $vmName -ResourceGroupName $rgName $image = New-AzureRmImageConfig -Location $location -SourceVirtualMachineId $vm.ID New-AzureRmImage -Image $image -ImageName $imageName -ResourceGroupName $rgName 

在这里输入图像说明

有关generalize vm和创build映像的更多信息,请参阅此链接 。

顺便说一下,你添加的评论是正确的,我们可以用这种方式使用图像。