Moving Azure Managed Disks between Azure Resource Groups

VMs with Managed Disks is the new normal in Azure IaaS. Imagine the scenario where you have to move your Azure VM with managed disks to a different resource group within the same subscription. Can we do this on the fly? The answer is no.

Wait What?

Here is a list of all the things you can’t do with Managed Disks in IaaS VMs. Following resources cannot be moved when you have managed disks in your VMs.

  • Managed disks
  • Virtual machines with the managed disks
  • Images created from managed disks
  • Snapshots created from managed disks
  • Availability sets with virtual machines with managed disks

How can we overcome this?

The solution is obviuously pretty simple.

  • Stop (deallocate) the VM with managed disks
  • Create snapshots for the attached managed disks in the target resource group
  • Create new managed disks in the target resource group using above snapshots
  • Deploy a new VM using the new managed disks in the target resource group