This document describes the steps necessary to migrate a VMWare virtual machine (.vmx and accompanying .vmdk) to the Microsoft Azure cloud. More detailed documentation is available from Microsoft: Creating and Uploading a Virtual Hard Disk that Contains the Windows Server Operating System and How to Upload a VHD to Windows Azure.
Get the Azure SDK
Download the Microsoft Azure SDK from https://www.windowsazure.com/en-us/develop/downloads/.
Create a Management Certificate
- Open the Visual Studio Command Line Prompt as an Administrator
- Execute the following command:
makecert -sky exchange -r -n “CN=<CertificateName>” -pe -a sha1 -len 2048 -ss My “<CertificateName>.cer” - Browse to C:\Windows\SysWOW64 and locate the .cer that was just created.
Note: If you get an error CryptCertStrToNameW failed => 0x80092023 (-2146885597), delete and retype all of the double-quotes in the command.
Add a Management Certificate
- Sign into Windows Management Portal
- Click on Preview and then Take me to Previous Portal (Note: this is probably a temporary step while Microsoft spins up its IaaS implementation).
- Click on Hosted Services, Storage Accounts & CDN
- Click on Management Certificates
- Click Add Certificate
- Click Browse and browse to the .cer file created in the previous step.
Get Account Login Details
- While in the Management Certificates section, select the thumbprint (ex. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX) and copy/paste it somewhere safe
- Click on the Subscription that the certificate belongs to and select the Subscription ID (ex. ########-xxxx-xxxx-xxxx-xxxxxxxxxxxx) and copy/paste it somewhere safe
Setting Up Your VMware Image
There are several changes that should be made (if needed) to your VMware image before it is converted and uploaded to Azure.
- Remove all snapshots – remove any snapshots that you may have. If you do not want to remove snapshots, create a copy of your .vmdk and create a new VMware image that points to it.
- Partition must be IDE – If you have any SCSI Devices, you should convert them to IDE. You may want to use a third party tool to do this such as Acronis.
- Uninstall VMware tools- if you have installed the VMWare tools, remove them.
- Enable Remote Desktop Access – you will want to enable remote desktop connections and make sure that they are permitted through the firewall (if enabled).
- Install the Hyper-V Role
- Run SysPrep Browse to %windir%\system32\sysprep and run sysprep.exe Make sure Enter System Out-of Box Experience (OOBE) is selected and Generalized is checked
Convert VM to VHD
VHD (Virtual Hard Disk) is the only format that Windows Azure supports so it will need to be converted if the image is from VMWare Workstation. There are a variety of tools available for converting images; I found that the StarWind Image Converter worked well.
Upload to Azure, Setup & Connect
Once the VM has been converted to VHD format, it is ready to be imported to Azure.
- Open the Azure Command Line Prompt
- Execute the following commands:
csupload Set-Connection “SubscriptionId=SubscriptionId;CertificateThumbprint=CertThumbprint;ServiceManagementEndpoint=https://management.core.windows.net”
Note: Use the SubscriptionId and Thumbprint noted earliercsupload Add-PersistentVMImage –Destination “<BlobStorageURL>/<YourImagesFolder>/<VHDName>” -Label <VHDName> -LiteralPath <PathToVHDFile> -OS Windows
Note: If you have not created a blob, go to Storage and then New. Once created, select the storage instance to get the BlobStorageURL. You do not have to have an images folder; it will create any path that you enter.
Depending on the size of your image and your upload connection speed, it can take up to several days to upload an image. Once the upload is complete, you can create the VM and connect to it.
- Click New (Bottom Left)
- Select Virtual Machine then From Gallery
- Select My Images
- You should now see your image listed. Configure your machine as needed.
- Once complete, Azure will begin creating and provisioning your VM.
- After your VM has been provisioned, click Connect and save the .rdp file where ever you like
- Execute the .rdp file to connect to the VM
Note: My provisioning failed; however, I was still able to connect to the image and it appeared to be fine. I am in the process of researching this issue.
References
Microsoft. (2012). Creating and Uploading a Virtual Hard Disk that Contains the Windows Server Operating System. Retrieved June 19, 2012, from https://www.windowsazure.com/en-us/manage/windows/common-tasks/upload-a-vhd/. Microsoft. (2012). How to Upload a VHD to Windows Azure. Retrieved June 19, 2012, from http://msdn.microsoft.com/en-us/library/windowsazure/gg465385.aspx.
The post Migrating a VMware VM to Azure appeared first on Messor Solutions, LLC..