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:
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:
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:
azure vm disk upload http://sourcestorageaccount.blob.core.windows.net/migratedvhds/myvm.vhd http://targetstorageaccount.blob.core.windows.net/migratedvhds/myvm.vhd TARGETSTORAGEACCOUNTKEY
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.