justinkendra - Fotolia
For many years, the IT industry has been pushing IT pros to move workloads to the cloud. Although there often are benefits to operating in a public cloud, some workloads are better suited to running in on-premises data centers. Fortunately, most major public cloud vendors make it relatively easy to move VMs off the public cloud and back on premises.
Microsoft, for instance, makes it simple to move Azure VMs to Hyper-V. Even so, there are several important things you need to understand before attempting this type of VM migration.
Before the migration
The first thing you need to know about moving Azure VMs to Hyper-V is that even though Azure hosts VMs on a cloud-based copy of Hyper-V, you won't be able to live migrate the Azure VMs to Hyper-V. In fact, you won't even be able to perform an offline migration of the VM. Instead, the process requires you to shut down the cloud-based copy of the VM and then download the virtual hard disks. Once the download is complete, you'll have to manually create a Hyper-V VM and configure it to use the virtual hard disks you've downloaded.
Even though this process isn't as straightforward as a live migration, it isn't especially difficult. Besides, migrating VMs in this way does come with one significant benefit: The Azure VMs are unmodified by the download process, which means you can go back to running VMs in the cloud if something were to go wrong with the transition to Hyper-V.
As previously mentioned, Microsoft makes it easy to download virtual hard disks from Azure. If you look at Figure A, you can see that Azure identifies a path and filename for each of a VM's hard disks. Make note of this information so you can find the virtual hard disk within the storage blob.
Now, go to your storage account and navigate to <your storage account> | Blob Service | VHDs | Blob Properties. Upon doing so, you should see the virtual hard disks used by your VMs -- assuming you created the VMs using the default storage options. Select the virtual hard disk that's associated with the VM, and then click the Download link. You can see what this looks like in Figure B.
In spite of the ease of downloading virtual hard disks, there are several things you must consider prior to moving forward with a download. First, the download is probably going to take a long time. Azure generally does not use thinly provisioned virtual hard disks. Hence, a default 127 GB virtual hard disk is going to result in a 127 GB download.
Another thing to consider is that Azure uses the legacy VHD format for virtual hard disks. It's a good idea to convert the VHD file that you have downloaded into VHDX format prior to placing the VM into production use. Converting the virtual hard disk to VHDX format will allow for a larger maximum size and better performance. However, you'll need to be mindful of the fact that the conversion process requires you to have enough disk space available to temporarily store two copies of the virtual hard disk -- the original and the converted copy.
One easy to overlook aspect to the migration process is licensing. When you create Azure VMs, your Azure subscription is essentially the license for the VMs. When you move the VM off Azure, that license no longer applies. As such, you must make sure that you properly license the VM prior to running it in your own data center.
After the migration
Earlier, I mentioned that you would probably have to do some cleanup work on the VM before using it in production. Unfortunately, there isn't a standard checklist of items to clean up. Every VM is different, and the post-migration cleanup tasks vary from one VM to the next. Some of the more common cleanup tasks include:
- Installing Hyper-V Integration Services;
- Verifying that the VM is connected to a Hyper-V virtual switch and has been assigned an appropriate IP address;
- Making sure that the VM's domain membership is still valid;
- Checking the Windows pagefile to ensure that it's properly configured and
- Making sure that network drive mappings are functional and that the correct drive letters are being used.
Even though Microsoft makes it easy to move Azure VMs to Hyper-V, it's a good idea to create some test VMs in the Azure cloud and experiment with moving those VMs before attempting to migrate a production VM.
Learn about new features in Windows Server 2016
Upgrade Hyper-V VM configuration version
Fine-tune your Hyper-V performance
SCVMM isn't the best choice for managing Azure VMs