is it possible to make virtual machine scale set using manged disk. i am trying this in vmss vm profile but keep getting error

        "dataDisks": [{
                "[resourceId('Microsoft.Compute/disks', 'testvm_OsDisk_1_bac5bcaf20ec4cafbb0f452d631fe68f')]"
    message ": " Parameter 'osDisk.managedDisk.id' is not allowed.

For now, we can't use managed disk to create Azure VM directly.
But we can create a managed image of managed vm or a snapshot via PowerShell, after that we can use this new image to create azure VM.

$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

enter image description here

More information about generalize vm and create image, please refer to this link.

By the way, the comment you added is right, we can use image in this way.


Don't give your osdisk a name, e.g. for osdisk:

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

e.g. for data disks:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.