Upload a VHD to Windows Azure

Upload a VHD to Windows Azure

Q: How can I upload and attach a virtual hard disk (VHD) file to Windows Azure?

A: If you have a VHD file that you want to upload to Windows Azure and use with a virtual machine (VM), it's very easy to do with Windows PowerShell.

Make sure it's a VHD file and not VHDX (as VHDX is currently not supported) and is 1023GB or less in size (the Windows Azure maximum). Replace the variables with your source VHD and target location name.

$sourceVHD = "D:\Temp\vhdtst.vhd"

$destinationVHD = 
"https://YOURSTORAGEACCOUNT.blob.core.windows.net/vhds/vhdtst.vhd"

Add-AzureVhd -LocalFilePath $sourceVHD -Destination $destinationVHD 
-NumberOfUploaderThreads 5

After the VHD is uploaded, it must be set as a data type disk and given a name. If it should be configured as an OS type, then add the -OS Windows or -OS Linux parameter depending on the OS type.

Add-AzureDisk -DiskName 'vhdtst' -MediaLocation $destinationVHD -Label 
'vhdtst'

 

$mySvc = "YOURSERVICENAME"

$myVM = "YOURVMNAME"

Get-AzureVM -Name $myVM -ServiceName $mySvc |

    Add-AzureDataDisk -Import -DiskName vhdtst -LUN 2 |

    Update-AzureVM

 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish