UPDATE: Windows Azure PowerShell greatly simplifies this process. See my blog Moving a System or Drive to Windows Azure for a walkthrough of the new process.
Virtualization is a great way to get the most out of your hardware. A virtual machine (VM) can be stood up and configured faster and more flexibly than a traditional machine can, but a VM still requires you to administer the host operating system and manage virtual hard disk (VHD) images. Windows Azure’s Infrastructure as a Service makes it even easier to run a VM by handling these requirements for you.
When you create a VM, you can choose from Azure’s gallery of Windows and Linux platform images as seen below, but the capability to use your own image is not immediately obvious. Microsoft offers a guide for doing so, but it’s a little outdated and doesn’t fully explain the process.
Modernize applications and support business initiatives with Microsoft Azure
Now, we need to export the certificate. Right-click on the new certificate and click “Export.” Choose a location to export the certificate, type in a password for the certificate twice, and click “OK.” This exports a .pfx file, which contains both the public key and the private key.
Unless you want to customize which certificate store your certificate goes into, leave the first option selected and click “Next.”
Click “Next” and leave the default option for DER encoded binary X.509 (.CER) selected.
upload the vhd
Now, it’s time for the actual upload. Make sure your VHD is sysprep generalized, and open the Windows Azure Command Prompt. Execute the following commands, replacing the brackets with your information:
csupload Set-Connection "SubscriptionID=[SubscriptionIdentifier];CertificateThumbprint=[Thumbprint];ServiceManagementEndpoint=https://management.core.windows.net"
Note that the SubscriptionIdentifier is a hex value, not the subscription name.
csupload Add-PersistentVMImage -Destination "http://\[StorageAccount\].blob.core.windows.net/\[Container\]/\[DestinationFilename\]" -Label "[Friendly Label]" -LiteralPath "[Local Path]" -OS Windows
The friendly label didn’t seem to show up when I uploaded a VHD. Under the container, it just listed the VHD as its file name, but hopefully displaying the label will be added soon. Also, if appropriate for your VHD, you can change the OS flag from Windows to Linux.
When I left my laptop out overnight to upload the VHD, a well-meaning friend closed the lid, putting it to sleep, but that showed me one of the really nice things about uploads is that they will resume if the connection is interrupted, even hours later.
Enjoy running your own virtual machines in the Cloud!
- Windows Azure
- Virtual Hard Disk
- Infrastructure As A Service
- Virtual Machine