Migrating an Azure VM to Hyper-V or VMware

Hi All!

Before we get started, this post is also on my Medium page in case you prefer reading it there. Here’s a link to that!

Today, I’ll be showing you my process for migrating an Azure VM to Hyper-V or VMware.

As you may know, Azure VMs (Virtual Machines) are similar to any other VM platform, in that they allow you to run multiple systems on the same hardware all at once. The difference is that Azure VMs enable on-demand, highly scalable computing resources. Allowing you to stop and start systems in real-time depending on load and usage requirements.

One somewhat negative side of running VMs in Azure, or any cloud computing suite for that fact, is cost. These systems can quickly sky-rocket in terms of price, especially for larger systems with a lot of through put.

We recently had the requirement to migrate some Azure VMs, to our local infrastructure in order to save some money. They didn’t need to be in the cloud, so there was no point of them being in the cloud.

As this migration is done in stages, I’ll outline each section so that it’s easier to follow along. FYI, if you want to migrate an Azure VM to VMware, you’ll likely need to just Hyper-V as a middle man due to the formatting of the disks and VM config file in Azure.

Architecture Overviews

Azure – These are core compute resources within Microsoft Azure. Azure is a cloud computing platform provided by Microsoft
VMware – This is a virtualization and cloud computing technology company which provides a range of products and solutions for virtualizing computer infrastructures.
Hyper-V – Short for Microsoft Hyper-V, this is a hypervisor based technology developed by Microsoft. It allows you to create and manage virtual machines on the Windows operating systems.

Downloading the VM from Azure

First things, first. We will need to login to the Azure web portal that hosts the VM we want to migrate. You can do this by going to https://azure.microsoft.com/en-gb/get-started/azure-portal

Next, find the VM that you want to migrate. Open the settings for the VM and go into disks. You can see this in the below screenshot:

The Azure VM disks window

Under the table marked OS Disk, click on the blue text that shows the VM disk name. This name will be very long and unfortunately, I had to blank it out from the above screenshot.

Once you’ve clicked on the blue text, this should open the settings for the VM disk. Head over to the Disk Export tab and generate a new URL to download the disk. This is showing in the below screenshot:

Remember to download the Azure VM disk(s) directly onto your Hyper-V system so that you don’t need to move them again.

The Azure VM disk export window

Once downloaded, you can you move onto the next step!

Importing to Hyper-V

Note: the download may leave the file without an extension. If this happens, you will need to add the .vhd extension to the end of the VM disk(s).

We now need to use Hyper-V to convert the VHD file to the VHDX format instead. To do this, you can follow the below steps:

  1. Open Hyper-V
  2. Use the Edit Disk wizard on the right hand side
  3. Use the wizard to select the disk required
  4. Use the VHDX conversion option.

You can also see this process in the screenshot below:

Converting the Azure VM disk file format to VHDX

Once this disk has been converted. Go back into Hyper-V and create a new generation 2 VM with similar computing specs as the original Azure VM. Make sure to not create any new disks for this VM as we will be adding the converted Azure VM disk from earlier.

Once the VM has been created, add the new VHDX file to the SCSi controller. Making sure to untick the enable secure boot option in the VM firmware tab. This is shown in the below screenshot:

Disabling secure boot on the VM

After making those changes, the Hyper-V VM should now boot and function the same as the Azure VM.

Importing to VMware

From here, it’s much simpler to import the VM to VMware. You could use the VMware converter tool or the StarWind converter tool

You can either run these tools on the VM whilst it’s shutdown (faster) or run them locally on the VM whilst it’s powered on (slower).

I won’t go into too much detail for this process and it’s literally a case of use the tools provided.

Enjoy! 🎉

Leave a Comment

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

email popup image
Mark Harwood
NEVER miss a blog post again! Subscribe for email notifications whenever a new post is live!
Subscribe
NEVER miss a blog post again! Subscribe for email notifications whenever a new post is live!
Fill Out This Form, And I Will Be In Touch Shortly
Contact form image
I'll Be In Touch Soon