Last Updated on December 3, 2019 by Dishan M. Francis

AzCopy is a command-line utility that can use to transfer data in or out from s storage account (blobs or files). This can be used in Windows, Linux or macOS systems. The same utility also can use to migrate data from one storage account to another. 

In this demo, I am going to demonstrate how to use AzCopy to,

Upload data to the storage account

Download data from the storage account

Migrate data from one storage account to another 

Create Storage Account

Before using AzCopy, first, let's go ahead and create a storage account. I am going to use Azure PowerShell for this task. So, please make sure you have the Azure PowerShell module installed. More info about it can find under

1. Launch PowerShell console and connect to Azure using Connect-AzAccount

2. Create a new resource group using, 

New-AzResourceGroup -Name REBELRG -Location "East US"

3. Then create a new storage account using,

New-AzStorageAccount -ResourceGroupName REBELRG -Name rebelstorageacc1 -Location "East US" -SkuName Standard_LRS -Kind StorageV2

In the above, rebelstorageacc1 is the storage account name. It is using Locally redundant storage (LRS) as the replication option. It is also created as general purpose v2 storage account. 

4. As the next step let's go ahead and create Azure file share.

$storageacc = Get-AzStorageAccount -ResourceGroupName REBELRG -Name rebelstorageacc1

New-AzStorageShare -Context $storageacc.Context -Name rebelshare1

In the above, rebelshare1 is the new file share name and it is created under rebelstorageacc1 storage account. 

Create a shared access signature (SAS) token for Storage Account

SAS token allows providing temporally access to containers, blobs in a storage account. More information about SAS token can be found via 

Let's go ahead and create SAS token for this new storage account. Once done, we can use it to access the storage account using AzCopy. 

1. Log in to Azure portal ( as Global Administrator

2. Go to Storage accounts | rebelstorageacc1

3. Then click on Shared access signature option. 

4. In the new window, adjust the permissions and expiry date for the SAS token. In this demo, I am using default selections. Once settings are in place, click on Generate SAS and the connection string button. 

5. It will generate SAS token and service URLs. We will be using these later. 

Install AzCopy Utility

To install AzCopy, first, download the AzCopy executable using Then extract the file. 

Once the file is extracted, Open Windows command line as administrator and change the path to the new folder. 

Upload a File

Now we have everything ready. Let's see how we can upload a file to the new file share we created. 

In my demo environment, I got a file called mybook.pdf in C:\ drive. Let's see how we can upload it. 

To do that I am going to use,

azcopy copy "C:\mybook.pdf"

In above command, is my file share. ?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-12-03T09:31:15Z&st=2019-12-03T01:31:15Z&spr=https&sig=vg2FLBqswBMA1xoruMx%2BQPG19Bz5dZ0EzrPsWhq%2FHV8%3D is the SAS token.

As we can see it is successfully uploaded the file. 

We also can upload complete directories using,

azcopy copy "C:\TestDF" "" –recursive

In above, AzCopy will upload TestDF folder and its content. 

Download a file

We also can download files, directories, content of directories using AzCopy.

azcopy copy "" "C:\mybook.pdf"

In above example I am downloading a PDF file called mybook.pdf from rebelshare1. Local path of the file is C:\mybook.pdf. The SAS token for the action is ?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-12-03T09:49:40Z&st=2019-12-03T01:49:40Z&spr=https&sig=yrBY77JpfDpqLLYXeLQ3b%2B4xUFeMRvkFG4pBdq8Nswc%3D

We also can download Directoy and its content using,

azcopy copy "" "C:\TestDF" –recursive

In above, I am downloading TestDF folder in share with its content in to C:\TestDF

Move data between storage accounts

We also can use AzCopy to move data between storage accounts. For demo purpose, I went ahead and create another storage account and a file share. Let's see how we can move a file from one storage account to another. 

azcopy copy "" ""

In above, the source file is and it will be copied to 

In here I highlighted the source SAS token

azcopy copy "" ""

and below I highlighted the target SAS token

azcopy copy "" ""

We also can use the same method to copy the entire file share to another storage account. 

azcopy copy "" "" –recursive

in above I am copying all file shares from to 

As we can see it is easy to download, upload, migrate data using AzCopy command utility. This marks the end of this blog post. If you have any further questions about this feel free to contact me on also follow me on twitter @rebeladm to get updates about new blog posts.