Uploading disks and VMs to Azure



Before you can upload anything to Azure you need to make powershell aware of your Azure subscriptions.


These can be a minefield – especially if you have more than one and make a typo.

1) Delete any existing cached settings:  Delete the xml file from  ~\AppData\Roaming\Windows Azure Powershell

2) Get-AzureSubscription | select SubscriptionName, IsDefault (Should return nothing at this point)

3) Get-AzurePublishSettingsFile (asks you to logon and downloads a settings file with credentials)

4) Import-AzurePublishSettingsFile "C:\Temp\MSDNcredentials.publishsettings"

5) Get-AzureSubscription | select SubscriptionName, IsDefault (Should now return a list of your accounts and which is default)


Note: If you have spaces in any of your account names – its best to cut and paste from the output from Get-AzureSubscription to make sure its character perfect!

Prepare disk for upload.

If you have a local list that you have been using in Hyper V and you want to upload to Azure you need to first convert it (make sure there are no differencing disks etc for it).  Azure only supports fixed size (max 127GB) VHD disks (it doesn’t currently support vhdx disks)

If you need to convert a VHDX disk to a VHD you can do this using Convert-VHD

This HAS to be done using powershell on Windows 8 machine or later

Convert-VHD –Path c:\test\MY-VM.vhdx –DestinationPath c:\test\MY-NEW-VM.vhd

If you are just uploading a data VM then its relatively straight forward and the above should be sufficient.

If however you want to upload a bootable VM then there are a number of issues well described here: http://blogs.msdn.com/b/narahari/archive/2013/01/15/windows-azure-virtual-machines-gotcha-s.aspx

There is also an interesting looking tool here that is supposed to do the whole process – but on one quick try failed for me: http://cloudscraper.migrate2iaas.com/azuredownload

Uploading disk

Again using powershell.  The process is quite smart – although Azure only supports fixed sized disks -  it checks for only written blocks to minimise file transfer size:

  • import-module azure
  • select-azuresubscription "mysubscriptionname"   $sourceVHD = "D:\StorageDemos\myvhd.vhd"
  • $destinationVHD = https://mwwestus1.blob.core.windows.net/uploads/myvhd.vhd 
  • Add-AzureVhd -LocalFilePath $sourceVHD -Destination $destinationVHD ` -NumberOfUploaderThreads 5
You get a nice progress indicator in Powershell as it uploads
From Telehouse a 20GB disk (Dynamic Hyper V Server 2008 R2 vhd) took about an hour.

How to snapshot and restore Azure vhds in powershell

Good description here:



Find out more