Uploading Windows VMs on Azure without using HYPER-V

Given that Windows 10 is soon to release on summer 2015, I needed to ensure that teams in our group have at least ran some sanity checks against the new Spartan Browser that comes as default on Windows 10. Unfortunately, when you upgrade Windows 10 images on azure you lose all your settings and resets your machine as first time setup. While other people had success remoting to the azure images after Windows 10 build upgrades, others (majority) have not been successful. If you’ve managed to update an existing Windows 10 image to a newer or later build, I strongly encourage to look at this article first:

Enable RDP or Reset Password with the VM Agent

http://blogs.msdn.com/b/mast/archive/2014/03/06/enable-rdp-or-reset-password-with-the-vm-agent.aspx

If the methods in the above article fails, you do have another alternative and that is to upload your own VHD and create an image out of it.

I assume that most of you have already have azure accounts. If not, you need to have an azure account created and have at least an azure storage service created and available. For this, see:

About Azure Storage Accounts

http://azure.microsoft.com/en-us/documentation/articles/storage-create-storage-account/

You need the following tools:

DISK2VHD – Great tool for generating .VHD files. Disk2vhd is a utility that creates VHD (Virtual Hard Disk – Microsoft’s Virtual Machine disk format) versions of physical disks for use in Microsoft Virtual PC or Microsoft Hyper-V virtual machines (VMs).

https://technet.microsoft.com/en-us/library/ee656415.aspx

Azure Powershell SDK – You need this to upload .VHDs to azure service

http://azure.microsoft.com/en-us/downloads/ (Windows Poweshell)

The PROCESS:

– Install Windows 10 on any machine as normal. I also suggest once installed, get the latest updates

– Use DISK2VHD tool to generate the VHD (https://technet.microsoft.com/en-us/library/ee656415.aspx)

– Follow the exact steps indicated on this article HOWEVER pause at Step 4 (Upload the .vhd file).

Create and upload a Windows Server VHD to Azure

http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-create-upload-vhd-windows-server/

Before you upload the .VHD, you need to ensure that you resize your VHD so it’s a whole number (disk size). Else, you will get the following exception when you proceed on creating the image using the VHD

“The VHD https://xxxxx.blob.core.windows.net/vhds/xxxx.vhd has an unsupported virtual size of xxxxxx bytes. The size must be a whole number (in MBs).”

Luckily, powershell comes with a cmdlet that allows you to resize VHDs and it only takes seconds to do it.

RESIZE-VHD

https://technet.microsoft.com/en-us/library/hh848535.aspx

The specific command is:

PS C:\> Resize-VHD –Path c:\BaseVHDX.vhdx –SizeBytes 1TB

Once you’ve resized your VHD as fixed Whole Number. Then proceed to Step 4.

The key in this process is to ensure that you’ve:

  1. Ran SYSPREP on the vhd (Windows 10 in this case)
  2. Resize the VHD to avoid the exceptions when creating an Image

Hope this helps!