Photo by @tambuzi / Unsplash.com

Getting started with Azure Migrate: Migrating an on-premises Hyper-V Virtual Machine to Azure

I set out to migrate a few of my old virtual machines to Azure a few months ago. That didn’t end well, as I was lacking a real server – I run all my VMs on Windows 10, and most tools require a Windows Server as the Hyper-V or VMware host. A manual migration might work, where you shut down the VMs, and manually move the virtual disks to Azure. This I want to avoid.

So, with my recent refresh of workstations at home, I now have a separate physical machine running Windows Server 2019, and it’s the host for my VMs. I now wanted to migrate one VM from my internal network to Azure, using Azure Migrate. This would be a 1:1 cutover migration, where the VM no longer resides locally but runs only in the cloud.

My local Hyper-V host is imaginatively named SRV. It’s a fresh Windows Server 2019 (Standard Edition) install, with 64 GB of RAM and an older Intel i7 CPU, that supports virtualization. The VM I need to migrate has 8 GB of RAM and 4 virtual processors:

To put this in a simple diagram, this is what I want to achieve – migrate a Hyper-V VM named WS2019 on SRV to Azure.

Running Azure Migrate

To get started with the migration, I created a new resource group in one of my Azure subscription, named amp. Then, from Azure Marketplace (click the + Create a resource link in the main navigation) I searched for Azure Migrate:

When you click Create, it shows you a dashboard instead.

From here, I can choose to migrate VMs, databases, or other assets (such as Web Apps). I chose to Assess and migrate servers. This will show you all the tools for Azure Migrate – and you can see some of my previous attempts below:

First I need to run a server assessment against my local Hyper-V box, and then I can initiate a migration. Clicking Discover within Azure Migrate: Server Assessment provides with detailed instructions how to move forward. In essence, you’ll download a pre-packaged VM that runs locally, and assesses the environment.

The Azure Migrate Appliance VM is a 30 GB VHD file, that is easily imported to Hyper-V. Once you start the VM, you can remotely access the tool at https://<ip>:44368.

The appliance will first patch itself and then discover the Hyper-V server details. This took about an hour for me – patching took about 20 minutes, and discovery and reporting the rest. Once done, Azure Migrate (in Azure Portal) shows you the results.

From here, you can create the actual assessment. This assessment will match what you have locally, into what the result would be in Azure. To create it, fill in the desired properties:

This allows you to define the target VM size, and which VM families you’d like to consider for the target VM.

I ran the assessment, and it produced a nice and clean report:

You can re-run the assessment and tweak with the properties to get the desired results. I feel this mostly driven by cost, and the desired utilization of the migrated VM.

To initiate a replication, click on Replicate in the Azure Migrate overview page. This will walk you through the wizard:

You can see that my local VM has one issue, where the boot type is unsupported. This is because I set the VM initially to Generation 2, and not Generation 1 in Hyper-V. Thankfully, Azure Migrate is clever enough to change this on the fly during replication, so there is no need to re-provision the VM first in Hyper-V.

You can also define what VM size you’d like to target for in Azure.

Once you’re ready with the wizard, you can initiate the replication. The source VM will remain as-is, until you are happy with the results and then it can be shut down to complete a migration.

During replication, I checked how the Hyper-V host was performing. My outbound Internet connectivity is 500 Mbps, and Azure Migrate was really trying to furiously to saturate it:

Once I was happy with the result, I completed the migration. This automatically shuts down the VM from my Hyper-V, as the migrated VM is now live in Azure.

In summary

All in all, this exercise took me a few hours to complete from start to finish. Patching the Azure Migrate Appliance took about half of this time. Running everything else, including the assessments and replication were very straightforward for just one VM.

I logged in to the migrated VM and it was working as expected. This was a nice experience, as most of the mundane tasks of migration can now be automated even in larger environments. As Azure Migrate also support VMware-based hosts, I feel this is a smooth and mostly error-free approach to migrating to the cloud.

Server assessment and migration are free for Azure Migrate when your provider is Microsoft (meaning Hyper-V, essentially). If you’re using third-party tools then there are additional costs involved.

Additional resources