Azure JSON custom VHD to VM

I had a customer the other week who had a Hyper-V environment and wanted to move to Azure, however they had Windows Server 2012 (non R2) which Azure Site Recovery doesn’t support. They had to start the procedures to move VMs manually to Azure.

So I made up a JSON template which they can use to help move their VM workloads to Azure. All they need to do is to start the beginning phases on-prem themselves to prepare the disks. They need to convert their VHDX disks to VHD using Convert-VHD.

Convert-VHD –Path c:\test\MY-VM.vhdx –DestinationPath c:\test\MY-NEW-VM.vhd -VHDType Fixed

Follow the steps to prepare the disk to copy to Azure – – please note, the image doesn’t really need to be generalised.

Then upload the VHD disk to a blob storage account in the same region and subscription as to where they want to create the Azure VM. Pick an existing storage account or create a new storage account, then create a storage container to copy the VHD to, and give the container public read access and copy the URI for the actual VHD disk itself, use the free Azure Storage Explorer, to do all of this as this is the easiest storage tool to use. The URI copied to the clipboard will need to be fed into the JSON template below as a parameter value when run.

When run, the JSON template below will allow the customer to specify the VHD blob storage URI for the VHD file in their blob storage account and choose an existing vNet for which to deploy the VM to. The VHD disk specified would then be converted to a managed disk automatically and then a new VM would be provisioned from this new managed disk.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s