Azure – You can now convert/migrate virtual machine with unmanaged disks to managed disks

If you are using Azure Virtual Machine and have configure it to use unmanaged disks, you can now migrate to managed disks without having to delete and recreate the virtual machine.

The below list gives you some good reason to move to managed disks:

  • Scale your application without worrying about storage account limits
  • Achieve high-availability across your compute and storage resources with aligned fault domains
  • Create VM Scale Sets with up to 1,000 instances
  • Integrate disks, snapshots, images as first-class resources into your architecture
  • Secure your disks, snapshots, and images through Azure Role Based Access Control (RBAC)

More information about managed disks can be found here

You can perform this migration either using Azure portal (, PowerShell or Azure Cli.


The conversion from unmanaged to managed disks can not be reverted

The virtual machine will be shutdown (and then restarted) during the process


Using Azure Portal

To perform the migration from unmanaged disks to managed disks using Azure portal, just connect to your portal ( and reach out the Virtual Machines blade


Then, to help you identify which virtual machine is using or not the managed disks features, click on the Edit columns and then add the Uses managed disks option from the Available columns and then hit Apply


Then access the virtual machine properties by clicking on the name, a blue banner is displayed to tell you the virtual machine is not using managed disks


When you click on this banner you will get some information and at the bottom a Migrate button


When you hit the Migrate button the portal initiates the migration by stopping the virtual machine and then complete the migration from unmanaged to managed disks


You can check the progress with the Notifications


Once completed, when you refresh you virtual machines list, you will now see your ‘migrated’ VM is now using managed disks and your virtual machine is restarted



Using PowerShell

Connect to your Azure tenant with PowerShell (as usual always best to use the latest release of the Azure PowerShell modules – at the time of writing the latest version is 6.6.0)


Then you need to shutdown your virtual machine

$rgName = “resourcegroupname”
$vmName = “virtualmachinename”
Stop-AzureRmVM -ResourceGroupName $rgName -Name $vmName –Force

Then you can request the migration to managed disks

ConvertTo-AzureRmVMManagedDisk -ResourceGroupName $rgName -VMName $vmName


If your virtual machine is part of an availability set, you will need first to convert your availability set

$rgName = ‘myResourceGroup’
$avSetName = ‘myAvailabilitySet’

$avSet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName -Name $avSetName
Update-AzureRmAvailabilitySet -AvailabilitySet $avSet -Sku Aligned

Then you can request to shutdown and migrate one by one the virtual machines of your availability set

$avSet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName -Name $avSetName

foreach($vmInfo in $avSet.VirtualMachinesReferences)
  $vm = Get-AzureRmVM -ResourceGroupName $rgName | Where-Object {$_.Id -eq $}
  Stop-AzureRmVM -ResourceGroupName $rgName -Name $vm.Name -Force
  ConvertTo-AzureRmVMManagedDisk -ResourceGroupName $rgName -VMName $vm.Name

Leave a Comment

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.