Cloud – IaaS

Home » Cloud Computing » Uploading a VHD file to Windows Azure

Uploading a VHD file to Windows Azure

Categories

Blogs I Follow

Advertisements

Although there are many ways to upload an image file to Azure (including GUI based tools) but I think Powershell is still the best and the most efficient option.

Why? because of the following reasons:

  1. Add-AzureVHD commandlet automatically converts a VHDX file to VHD during upload. This is useful since Windows Azure only supports VHD for now.
  2. Add-AzureVHD is “aware” of the VHD format and so copies only the bytes that contain data and skips the empty ones. This saves a lot of time – it took 10 minutes to upload a file with Add-AzureVHD vs. 80 minutes for the same file with another GUI based tool.
  3. Add-Azure also uses a checksum to verify the integrity of the uploaded file.

Hopefully by now you are convinced and are asking how to do it. Well, it’s really simple but before you actually do it, make sure that the VM image that you are about to upload is set to use DHCP and that Remote Desktop is enabled otherwise you will not be able to connect to it. The same applies to Linux based machines, but SSH needs to be working instead of RDP.

Lets’ get to it…

First you have to download and install the Windows Azure PowerShell module by running the Microsoft Web Platform Installer.

Then you need to configure your Windows Azure Subscription by following the following steps:

  1. Launch Windows Azure PowerShell
  2. In the powershell prompt, type the following
    1. Get-AzurePublishSettingsFile
    2. Import-AzurePublishSettingsFile “C: Subscription-1-1-10-2014-credentials.publishsettings”

To upload an image, follow the steps below:

  1. $sourceVHD = “D:Virtual Hard DisksWindows2012.vhd” <enter>
  2. $destinationVHD = “https://abc.blob.core.windows.net/vhds/MyWindows2012.vhd” <enter>
  3. Add-AzureVhd -LocalFilePath $sourceVHD -Destination $destinationVHD -NumberOfUploaderThreads 3 <enter>

Azure PowerShell

To make the uploaded image usable you can continue to use the powershell, but I prefer the GUI for this task (unless scripting):

  1. login to your Azure account at https://manage.windowsazure.com
  2. click on the “VIRTUAL MACHINES” tab
  3. Click on “DISKS”
  4. Then click on “CREATE”
  5. Fill out the “NAME” and browse for the VHD URL and pick the file just uploaded
  6. Make sure that “The VHD contains an operating system.” is checked
  7. Click  “OK”

VHD

Now you can create a virtual machine using the uploaded vhd file by “creating a virtual machine from the gallery” and then picking “MY DISKS”

Gallery

Thank you for reading – visit often for new tit-bits !!!

 

Update!!!

You can download a VHD by running the following powershell commands:

$destinationVHD = “D:Virtual Hard DisksWindows2012.vhd” <enter>
$sourceVHD = “https://abc.blob.core.windows.net/vhds/MyWindows2012.vhd” <enter>

Save-AzureVhd -Source $sourceVHD -LocalFilePath $destinationVHD -NumberOfThreads 3

Advertisements

5 Comments

  1. alinzaman says:

    You can also download the Azure publish settings file by visiting https://windows.azure.com/download/publishprofile.aspx

  2. We used Azure for almost 2 years and we still found the process to upload VMs to Azure very long and complicated.

    I wrote a tool called CtxAdmTools Azure Upload VM to automate the process of uploading images and create VM on Azure with few clicks.

    The tool is available at http://azureuploadvm.ctxadmtools.com

    Guillermo Musumeci
    CtxAdmTools

  3. […] Upload VHDs (link1, link2, link3) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Mir Majeed

CRM & Mobility News

%d bloggers like this: