Migrate your VMware VM to Windows Azure in 30 Minutes

You are running your virtualized workloads on top of VMware? You’ve heard about Windows Azure and believe it could be a valuable alternative or extension to your current IT landscape? Check out how you can migrate VMware Windows Server Guest VMs directly to Windows Azure in only a couple of steps using the Microsoft Virtual Machine Converter.


Overview

If you are using VMware virtualization software (VMware vSphere, VMware Workstation, VMware Player) to host your Windows Server VMs, you can use the Microsoft Virtual Machine Converter (MVMC) to convert these VMs to the Windows Server Hyper-V format. MVMC is a free download, a solution accelerator officially supported by Microsoft.

MVMC has two migration modes:

(1) A Wizard-driven UI that allows conversion of running VMware VMs directly to a Windows Server Hyper-V host within your own network.

(2) Offline conversion of VMware-based virtual hard disks (VMDK) to Hyper-V-based virtual hard disks (VHD) using the MVMC command line interface (CLI).

As the hypervisor used in Windows Azure is based on the Windows Server 2012 bits the file format of guest VMs in Azure is identical with standard Windows Server Hyper-V. This means that we can take the on-premises VHD file, upload it into our Windows Azure subscription and boot a virtual machine off of it.

The second approach (offline conversion using the CLI) is the way to go, as it allows direct migration to the cloud without having to use on-premises Hyper-V as an intermediate step. This post will describe how to do it step-by-step, starting from a VMware guest VM all the way to a running Windows Azure instance. I tested the migration using both VMware Workstation and VMware Player with a Windows Server 2008 R2 guest VM.

The migration process could also be automated end-to-end using the MVMC CLI and the Windows Azure PowerShell Cmdlets. Thus you could integrate the procedure with your datacenter automation workflows, e.g. such as those authored and executed within System Center 2012 Orchestrator.

There’s a couple of prerequisites and limitations when using MVMC in its current version 1.0, see documentation on the download page and on TechNet. In terms of Azure the only supported OS that can currently be migrated is Windows Server 2008 R2. Older Windows Server OSs (2008 and 2003 SP2) and Client OSs (Windows 7) are supported by MVMC, but cannot be deployed to Windows Azure.

Download and Install MVMC

First go ahead, download Microsoft Virtual Machine Converter and install it on the machine that you want to run the migration on. MVMC will install to c:\Program Files (x86)\Microsoft Virtual Machine Converter Solution Accelerator.

Prepare the VMware Guest VM

In my case I was running a single processor Windows Server 2008 R2 guest VM with 1GB of memory on a single 9GB primary hard disk. I configured the disk size to a minimum in order to keep upload times to the Windows Azure datacenter as short as possible.

VMwarePlayer

First, you need to prepare your original virtual machine for the migration. One thing to do is to configure the VM for DHCP as Windows Azure virtual machines do not support static IP addresses. Also configure automatic DNS server addresses, as shown below:

DHCP

Next, enable Remote Desktop connections and optionally add a user to the ‘Remote Desktop Users’ group. The built-in administrator account has remote access by default. Note: not enabling remote access will leave the VM inaccessible in Azure later on!

RemoteDesktop

After you’ve done that shut down the VM.

Convert VMDK to VHD

Open a command prompt and change to the MVMC installation directory (c:\Program Files (x86)\Microsoft Virtual Machine Converter Solution Accelerator). Execute the following statement in order to convert from VMDK to VHD (replace the paths to the source vmdk and target vhd file to your environment):

mvdc.exe “c:\vmware\W2k8.vmdk” “c:\vhd\W2k8.vhd”

Note: MVMC will uninstall the VMware tools in the guest prior to conversion to provide a clean way for migration to Hyper-V.

The output should look as follows:

MVMC

In my case the conversion completed within 4 minutes for the 9GB vmdk file, reading from and writing to a single SSD. As a result now we have a Hyper-V compliant VHD file.

Upload VHD to Windows Azure

Next, you need to upload the VHD file to a storage account in your Windows Azure subscription. The most reliable and efficient way to do this is via the Windows Azure PowerShell Cmdlets. Execute the following statement in your PowerShell environment on your migration machine:

Add-AzureVhd –LocalFilePath “c:\vhd\W2k8.vhd” –Destination “https://<yourstorageaccount>.blob.core.windows.net/vhds/W2k8.vhd>” –NumberOfUploaderThreads 5

This statement will upload your VHD file as a page blob to the specified storage account and container and will make it a fixed VHD. The output should look like this (snapshot from PowerShell ISE console while upload was running):

Upload

The duration of the upload process will depend on the bandwidth of your Internet link. With a 100 MBit/s uplink it will take around 15 minutes. I am lucky, as in my office we have an even bigger pipe, so uploading to Windows Azure is a blast.

Register VHD as OS Disk

Before you can start the new VM in Windows Azure you will have to register the uploaded VHD as a bootable Windows OS disk by executing the following PowerShell statement:

Add-AzureDisk –DiskName “VMWareTest” –MediaLocation “https://<yourstorageaccount>.blob.core.windows.net/vhds/W2k8.vhd>” –OS Windows

Your disk should now show up as VMWareTest in the Disks section under Virtual Machines in the Management Portal.

Create Windows Azure VM

As a final step, now you can create a new VM off of the registered VHD and start it up. You can do that via the Management Portal or again using PowerShell like this:

New-AzureVMConfig –DiskName “VMWareTest” –Name “w2k8” –InstanceSize Small |
Add-AzureEndpoint –Name “RDP” –LocalPort 3389 -PublicPort 3389 –Protocol tcp |
New-AzureVM –ServiceName “<yourdnsname>” –Location “North Europe”

This statement will start your VHD up as a virtual machine w2k8 in the North Europe datacenter within a couple of minutes. Make sure to replace <yourdnsname> with a unique DNS name of your choice. Note: the guest will keep its hostname from the VMWare image.

Portal

You should now be able to connect to the Windows Azure VM via RDP over port 3389 using the same administrator account (or any other account configured for remote access) you used for your VMware VM on-premises.

RDP

That’s it!

3 comments on “Migrate your VMware VM to Windows Azure in 30 Minutes
  1. If I have two disks, one data disk and the other an OS disk, how does the MVMC tool determine which one to register as the OS disk?

  2. Pingback: Migrating A Virtual Machine To Azure | 36 Chambers - The Legendary Journeys: Execution to the max!

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>