Tuesday, 20 September 2016

Convert Classic Azure VM to Azure Resource Manager with Powershell

Problem

I have a classic VM which I want to move into an Azure
Resource Manager machine. The only way this is currently possible is to
recreate a new machine using an existing VHD. Unfortunately this doesn’t work
if you just try to create an RM machine using the existing classic storage VHD.

You can get the VHD location for the powershell code from Azure Portal, click on the stroage account and in through blobs, vhds etc.

Resolution

Copy the vhd to a new storage account using the Azure Storage
Explorer or Powershell. You will need to change the access
policy on the vhd to Blob or Container in order to copy using the Storage
Explorer. There is a powershell method (linked above) which allows you to copy
the file using authentication.

Changing the access
policy for the vhd file in Azure Portal

File copy took about 20 mins going from central US classic
to Central US Resource Manager. Once completed the powershell code above can be
used to create a new virtual machine with an existing VHD