Q: I want to copy to Windows Azure a virtual hard disk (VHD) containing an OS for use with a virtual machine (VM)--is there anything special I need to do?
A: Windows Azure uses Hyper-V as its hypervisor, which means a VM running on Hyper-V will run on Windows Azure with the following conditions:
- Make sure it is a Generation 1 VM.
- Make sure it's VHD and not VHDX (if you have a VHDX, convert it with the Convert-VHD Windows PowerShell cmdlet) and make sure the size is 1023GB or less.
- Ensure the VM only has a single network adapter andthat it is of type synthetic and NOT legacy.
- Ensure the network connection is configured to obtain its IP address via DHCP (static IP addresses within the VM will not work).
- Ensure Remote Desktop is enabled (to enable connectivity to it).
- Install at least the Hyper-V Integration Services version in the VM.
- To be SUPPORTED in Windows Azure, it must be a 64-bit OS and one of the Windows Azure supported OSs (however, other OSs including 32-bit will work, they would be completely unsupported; I've run Windows 2003 32-bit in Windows Azure as a test and it worked fine).
- The VHD does not have to be fixed type but will be converted to fixed by the Add-AzureVhd PowerShell cmdlet when it's copied into Windows Azure.
After you've ensured all of the above is true, copy the VHD into Windows Azure and set it as a Windows OS disk by using PowerShell (replace with your VHD name, storage account, etc.). Once the below is done, create a new VM that uses this new disk.
PowerShell script to move a VHD into Windows Azure and attach it to a VM:
#Moving a VHD into Azure and attaching to a VM
$sourceVHD = "D:\Software\VHDs\win2k3.vhd"
$destinationVHD = "https://<your storage account URL>.blob.core.windows.net/vhds/win2k3.vhd"
Add-AzureVhd -LocalFilePath $sourceVHD -Destination $destinationVHD `
Add-AzureDisk -DiskName 'win2k3' -MediaLocation $destinationVHD `
-Label 'win2k3' -OS "Windows"