Copying VHDs (and other blobs) between storage accounts

The Windows Azure cross platform command line tools expose an extremely useful new feature in Windows Azure Storage which is the ability to asynchronously copy blobs into storage accounts. The source blobs do not HAVE to be in a Windows Azure storage account. They could be anywhere that is publicly accessible. For more details on this new feature see Gaurav’s post on new Windows Azure storage features.

In this post I’m going to show how you can use this feature to copy VHDs between storage accounts which is a very commonly requested activity.

To get started you will need to download and configure the command line tools:

http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/command-line-tools/

Once downloaded and configured the syntax for moving the blobs is simple:

azure vm disk upload <source-path> <target-blob-url> <target-storage-account-key>

The source path could be any publicly available source location such as an http server:
[sourcecode language="bash"]
azure vm disk upload http://sourcewebsite.cloudapp.net/copyme.zip http://targetstorageaccount.blob.core.windows.net/testcopy/copyme.zip TARGETSTORAGEACCOUNTKEY

The copy is made by the Windows Azure storage service itself so the bits are never copied to your local machine which makes the transfer MUCH faster than doing this using storage tools.

To copy VHDs you can use the same syntax:

Keep in mind that the source storage container either needs to be marked public or you can also specify the URL with a shared access signature which is the recommended approach for security reasons (put it in quotes). The target storage account doesn't need the signature because you are required to specify the storage account key.

Before you ask - yes we definitely will have this functionality in the Windows Azure PowerShell cmdlets in the near future.

Copying VHDs and other blobs between storage accounts in Windows Azure

Thanks!
Michael

6 thoughts on “Copying VHDs (and other blobs) between storage accounts

  1. Mark

    Your link to the tools goes to a page “Tools for Mac and Linux” is there a separate link for Windows based? Thanks

    Reply
    1. Michael Washam

      The Windows install directions are buried a bit but they are there:

      Linux and Windows: Install the latest version of Node.js (see Install Node.js via Package Manager), then run the following command:
      npm install azure -g

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>