Moving VMs from ASM to ARM

As Azure continues to evolve it has changed and as part of this change is the migration from Cloud Services (web roles, worker roles and virtual machines) to Azure Resource Manager (ARM).  In this blog post I will talk about moving your virtual machines from Cloud Services (ASM) to ARM.

For myself this was something I had been looking at doing for over a year now, I have several virtual machines I had built over my time using Azure and most of them were in Cloud Services.  The reason I really wanted to get them to ARM was two fold, I really want to be able to enable the auto-shutdown feature of the ARM based virtual machines, as I sometime forget to turn off my virtual machines and use up all my MSDN Azure allocation for the month in just a couple of day.  The other reason want to move to ARM is the better network controls that are available in the ARM virtual networks.

Ok, to get started, I don’t believe in rebuilding the wheel, and there are several methods with differing versions of complexity to do the move, but I found a good blog post – https://www.petri.com/migrating-azure-vms-classic-service-management-resource-manager and I used that to do my moving. There are several caveats to moving from ARM to ASM and they are covered in the referenced blog post.

The moving from ARM to ASM is a multiple step process and there are several factors that determine exactly which commands that you need to use.  The first question you need to answer is are your ASM VMs in a virtual network, if so, you will need to move the whole virtual network and all the included VMs, if not, you can move just a single VM, but the process will create a new virtual network with the name of the VM and “–migrated” appended.

The actual process of moving is a 3 step process, first you need to prepare your VM or Virtual Network to be moved with the –prepare parameter on the command (see referenced blog above).  Once the prepare completes, both the existing and the new Virtual Networks exist, to allow testing.  One important fact to keep in mind, is if the VM you are moving was not in a Virtual Network, it will be restarted during the move.  After your testing is complete you will then need to either Commit (“-commit”) or Abort (“-abort”) your changes.

Once the move has completed there is still one last thing to more, the storage account where the VHDs for your Virtual Machines are stored.  Again this is a 2 step process of –prepare and then –commit or –abort.  Also note that all VHDs in the storage account will be moved it is necessary to have moved all the Virtual Machines sharing that storage account before moving the storage account.

I hope this blog post helps you get your ASM virtual machine over to ARM.