How to attach offline created VHD to Virtual Machine?

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




Windows Azure enables you to attach the VHD drive from storage account. That means you can create by yourself a drive and attach it within Virtual Machine instance. Please note that drive can only be attached if it has been previously stored as a page blob in the Windows Azure storage. This is very important, because the way how storage works, guaranties that the data are persisted three times and in a case of geo location replication you will have 6 copies of your data.
Such features enforce a new way of thinking about data replication. In addition VHD images can also contain off-line fully deployed and tested version of your application, which is installed by attaching of drive. Such scenarios can improve the deployment of legacy applications in cloud at all.

Before you start, first create the VHD drive. You can do it as you want. For example Disk Management tool:


After that you have detached the VHD, you have to upload it to the storage drive as a page blob. Note that it is important to use CSUPLOAD tool which is a part of Azure SDK.To do that start SDK command prompt: as shown at the picture below07e162. This will register the path to CSUPLOAD.EXE.


As next, you have to upload VHD, but first connection information has to be set. Following line will setup so called connection string.

csupload set-connection "SubscriptionID=******;CertificateThumbprint=********;ServiceManagementEndpoint="

This is crucial step, because it is not well described and it is very error prone. The picture below shows two problems with the CSUPLOAD tool. On the beginning you will probably go to official page and copy paste some data. When doing that the pasting process will insert some Unicode characters (arrow on left) which will prevent the upload to execute correctly. More over (arrow on right) the mamanement endpoint shown at official article is not The right URL is


Please also note that upload will not work correctly if you re uploading from slow internet connection. For example Virtual NIC in virtual machine with slow bridged internet connection usually file after upload during registration of the VHD.

After the connection has been successfully set, you have to upload the VHD to the right storage account. Her have two options, but only one is the right one. I fyou have provisioned VM from your storage account then you have to use that account. However if the VM has been provisioned to the storage account created by provisioning process, then go to list of all your storage accounts and peek account name and key. To peek the right one, go first to VM dashboard and lookup the name o fthe account. Then you can find it easily in the list of all you storage accounts.


Finally you can start upload of the VHD.

csupload add-disk -destination "https://portalvhds***" -Label "MyDemoDisk" -LiteralPath "C:\Temp\MyDemoDisk.vhd"

After successful upload the disk will appear in the list of disks which can be attached.


Posted Jul 01 2012, 09:33 AM by Damir Dobric
Filed under: , ,


Carregando um VHD para o Windows Azure « Fabian Andr?? Gehrke wrote Carregando um VHD para o Windows Azure « Fabian Andr?? Gehrke
on 10-30-2012 16:13

Pingback from  Carregando um VHD para o Windows Azure « Fabian Andr?? Gehrke

SharePoint on Windows Azure - Part 2: Storage - Wahids SharePoint Blog wrote SharePoint on Windows Azure - Part 2: Storage - Wahids SharePoint Blog
on 03-08-2013 21:00

Pingback from  SharePoint on Windows Azure - Part 2: Storage - Wahids SharePoint Blog is a .Net Community Blog powered by daenet GmbH.