Migrate Azure VM to OnPrem Hyper-V Host

I recently had to move a test VM from Azure to an on-prem Hyper-V host.  I wasn’t able to to find a clear guide for a migration of a simple single VM so I figured I’d share how I achieved it:

1) In the Azure portal, browse to the VHD disk for the VM you wish to migrate and and choose Create Snapshot on the overview page and choose Full

2) Once the snapshot is generated, open it and click the Snapshot Export button on the left pane

3) Click Generate URL to create a SAS URL to download the VHD

4) Use azcopy.exe to download the file. 
Note: Do not use a web browser as the VHD files are typically too large and the downloads will eventually fail.  Azcopy.exe can be found here:

https://aka.ms/downloadazcopy-v10-windows

The command to download the file is:

azcopy.exe copy “[SASURL]” “C:\location\vmname.vhd”

5) Convert the VHD to VHDX using this command:

Convert-VHD -Path C:\location\vmname.vhd -DestinationPath c:\location\vmmame.vhdx -VHDType Dynamic

6) In Hyper-V Manager create a new Gen 2 VM and attach this VHDX to the VM and start it.  It should boot normally.

The only issue I had was the warning below about a license warning that I haven’t yet been able to resolve but otherwise the test VM is working and will be deleted shortly so I’ve just left it as is.

image

I hope this helps if you ever need to perform a quick and dirty reverse cloud migration.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.