Upload a VHD to Windows Azure

Quickly upload a virtual hard disk (VHD) to Windows Azure using Windows PowerShell.

John Savill

March 7, 2014

1 Min Read
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:Tempvhdtst.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

 

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like