0 out of 1 rated this helpful Rate this topic

How to Upload a VHD to Windows Azure

Updated: October 18, 2011

[This topic provides preliminary content for the beta release of the Windows Azure VM role feature. To apply for participation in the beta, log on to the Management Portal, click Home, and then click Beta Programs.]

After you create or change the server image, you are ready to upload the .vhd file that contains the image data to Windows Azure. There are two opportunities for uploading VHDs to Windows Azure. When you initially create a VM role, you upload a base VHD to Windows Azure, which is used as a template to create VM role instances. For more information about creating the base VHD, see Developing a Server Image for a VM Role in Windows Azure. After a period of time, you may need to make changes to the VM role instances. To do this, you upload a differencing VHD. For more information, see Changing the Server Image for a VM Role in Windows Azure.

You use the CSUpload Command-Line Tool to upload the base VHD or differencing VHD to Windows Azure. You must know the subscription identifier and the management certificate thumbprint to upload the .vhd file. You can find the subscription identifier in the Properties page for the subscription in the Windows Azure Management Portal. You can also find the certificate thumbprint in the Management Portal.

ImportantImportant
You must run CSUpload only once per VHD. It is possible to start multiple simultaneous uploads of the same VHD using CSUpload, but the processes will not finish correctly.

You need the subscription identifier to upload the VHD. You can copy and paste the information from the Management Portal to the command line.

noteNote
Before you start this procedure, you must have added a management certificate to the portal to upload a VHD. For more information, see How to Use Certificates With a VM Role in Windows Azure.

  1. Log on to the Management Portal.

  2. Click Hosted Services, Storage Accounts & CDN, and then click Management Certificates.

  3. In the Properties pane, you can find the certificate thumbprint under Thumbprint. The subscription identifier is under Subscription ID.

After you obtain the certificate thumbprint and the subscription identifier, you can upload the VHD.

  1. Open a Windows Azure SDK Command Prompt window as an administrator.

  2. Change the directory to where you saved the VHD image.

  3. Set the connection string by using the following command and replacing SubscriptionId and CertThumbprint with the values from your subscription:

    
    csupload Set-Connection "SubscriptionId=SubscriptionId;CertificateThumbprint=CertThumbprint"
    
    noteNote
    The certificate that you use must be installed in the certificate store.

  4. Upload the VHD by using the following command and replacing the VHD file name and displayed name:

    
    csupload Add-VMImage –LiteralPath VHDName.vhd –Location LocationValue –Name DisplayedNameInPortal
    
    noteNote
    The –LiteralPath and the –Location or the –AffinityGroup parameters are required, the –Name parameter is optional. The location or affinity group must match the location or affinity group that was defined for the corresponding hosted service.

  5. A dialog box for the Windows Azure VHD Verification Tool is displayed. This tool verifies that the operating system is in the proper state to be uploaded to Windows Azure. Click OK to continue the uploading process.

    noteNote
    If you want to automate the uploading of a VHD, you can use the –SkipVerify parameter for Add-VMImage to skip the verification step and suppress the dialog box.

You will see the VHD displayed under VM Images in the portal using the display name that you provided when you uploaded the VHD.

See Also

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Too many arguments for command Add-VMImage expects 0 argument(s) found 6


I've copied the command from this article(Step 4) and tried pasting directly on the Azure SDK command and got the following error.I've copied the command from this article(Step 4) and tried pasting directly on the Azure SDK command and got the following error.
 I've copied the command from this article(Step 4) and tried pasting directly on the Azure SDK command and got the following error.
 
I've copied the command from this article(Step 4) and tried pasting directly on the Azure SDK command and got the following error.

Too many arguments for command Add-VMImage expects 0 argument(s) found 6.
Found: '-LiteralPath', 'VHDName.vhd', '-Location', 'Southeast Asia', '-Name', 'w2k8l.vhd'
Named parameter "-LiteralPath <string>" missing for command Add-VMImage.


Resolution: After lot of research, troubleshooting I've realized that issue was due to encoding. I have deleted "-" from each parameter and typed it(-)manually to fix the issue.
Command Fails, use by this way to execute
Instead use two commands only use one command with both actions:
csupload Set-Connection "SubscriptionId=SubscriptionId;CertificateThumbprint=CertThumbprint" Add-VMImage –LiteralPath VHDName.vhd –Location "Anywhere US"