Here is how you can copy files from one Azure Storage account to another. Simple scenario for this is if you want to move entirely from one Storage account to another. In my case I was running for quite some time on a Gen1 Blob-only storage account and now i want to be on the new modern Gen2 general purpose storage account.


  • Acces to source and destination storage accounts


We want to move the data securely and quickly so the best choice is just by using Azure CLI, the AzCopy commands and SAS tokens to authenticate the requests.

Go to your source Azure Storage account and go to Shared access signature blade

shared access signature blade

Then create a SAS token. Basically what we aim for is to create a token which will allow access for only a limited period of time. By default we are offered one for 8 hours and with read/write access to all possible objects within the Storage account. Feel free to tweak any of the parameters or just leave them default, just like I do in the below screenshot.

When ready click on the "Generate SAS and connection string button" and copy the SAS Token somewhere, preferrably in Notepad so we can build the AzCopy command later.

generate SAS token

Now repeat this for the same for your destination Azure Storage account.

You have the two SAS tokens. Let's build the command that we are going to use.

The command itself is in this format

azcopy copy "" "" --recursive

replace the values with your own. Beware of double (??) quotation marks after the in the URL. You should only have one. Here is how the full command should look like

azcopy copy "" "" --recursive

With the command ready and copied to your clipboard, open a Bash session in your Azure Portal.

Azure bash portal

After loading, paste your command and hit enter

AzCopy command

You should see a progress of the ongoing transfer

AzCopy details

and it should run successfully and complete

AzCopy command success

That's it! Congrats. Check your destination storage account if the data is present. For me it is and it's quite a relief to do it so easy.

If you want to have a more specific copy (not just the entire storage account) read the official docs on AzCopy.

In general it should be as easy as specifying your container name in your URL. Such as https://<storage-account-name><container-name>. You can go as deep as /<container-name>/<blobdirectory>.

This also works for uploading files from local storage to Azure Storage account

azcopy copy 'C:\myDirectory' '' --recursive