Copying blobs between Azure accounts with AzureCopy

One feature in AzureCopy which was never fully implemented was being able to copy between 2 different Azure accounts while using the CopyBlob API. Everything was there *except* for the Shared Access Signature generation for the source URL. This has now been rectified. The fix has been checked into Github and will go into the next Nuget/command releases whenever they’re made.

So from a practical point of view you can now enter 2 AzureAccountKey “secrets” one for source and one for target (these are called SrcAzureAccountKey and TargetAzureAccountKey funnily enough). You can then issue the command:


azurecopy –i

“” –o

“” –blobcopy


This will copy from account1 to account2 and use the fantastic Azure CopyBlob API which means your bandwidth will not be used (direct DC to DC copy).

Copying to Dropbox with AzureCopy

I’ve been asked a question on how to use the AzureCopy Nuget package to copy between Azure and Dropbox. Admittedly this is slightly easier to do with the AzureCopy command than with the Nuget assembly. So here’s a quick rundown on how to do this.


Firstly, you need to register AzureCopy (whether it’s the command or assembly).


AzureCopy command

For the command the process is very simple:




You simply need to run the command: azurecopy –configdropbox

and follow the instructions.

The config file azurecopy.exe.config will be modified to include 2 new entries, DropBoxUserSecret and DropBoxUserToken. These 2 new entries are the secret/token for azurecopy.exe to be able to access your Dropbox files.


AzureCopy Nuget package

If you’re using the AzureCopy Nuget package, this means you’re creating a new application to access Dropbox (and other cloud storage services). To register your new app with Dropbox you’ll need to go to the registration portal. Once you’ve done that you’ll receive a DropBoxAPIKey and DropBoxAPISecret. These are yours (the developer) and shouldn’t be shared with the general public, for this reason I’ve setup the AzureCopy assembly to read these values from 2 locations. One is the app.config which is fine if you (or your company) are the only ones using your application.

The other location it reads these values from are embedded in the source code. Specifically the class APIKeys has 2 static public string member variables, DropBoxAPIKey  and DropBoxAPISecret. If the variables cannot be read from the app.config it will be read from this file. This allows the distribution of the key/secret to other parties without making it obvious what the values are. Obviously if you’re purely using the Nuget package then modifying the source is not possible and the app.config is your only option. If you prefer the source code approach then github has all you need.

Now that you’ve got this far (remember, you’ll only need to do this once) you still need to go through the steps similar to what we did above for the AzureCopy command. You’ll need to generate the Dropbox authorization url and have the user enter it into a browser and allow your new application to their Dropbox. To generate the authorization url you can simply use the static method DropboxHelper::BuildAuthorizeUrl which returns a string url.

This may sound like a lot of work but is really about 2 minutes of effort.


Blob Copy Code

Once you’ve registered your new app with Dropbox portal and have authorized your new app, the code to copy between Azure (for example) and Dropbox is very straight forward.

The simplest case in C# is:

(assuming the Azure credentials have already been updated in the app.config)


// Create an Azure “Handler” which is used to process all Azure requests.
var azureHandler = new AzureHandler();

// Create a Dropbox “handler” ditto.
var dropboxHandler = new DropboxHandler();

// full url to Azure Blob
var inputUrl =”;

// url to Dropbox folder where the blob will be copied too.
var outputUrl =”;

// read the blob
var blob = azureHandler.ReadBlob(inputUrl);

// write the blob
dropboxHandler.WriteBlob(outputUrl, blob);


Hey Presto!