1

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

"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.
0

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.

0

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.