How To Manage Files Between Local And Azure Storage With AZCopy


The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

Managing files is an important part of any business, particularly for companies that store a large amount of data. Azure offers its users both the Microsoft-developed File System and Storage Services which allows easy file management in addition to providing protection from cybercriminals. However, managing files between local storage and Azure can be challenging when working with multiple systems on different software platforms. AZCopy simplifies this process by automating file transfers while simultaneously verifying they are transferred correctly so that there’s never anything amiss.,

The “azcopy check if file exists” is a command-line tool that allows users to manage files between local and Azure storage with AZCopy.

How To Manage Files Between Local And Azure Storage With AZCopy

In today’s IT world, automation is omnipresent. Automation is essential for everything from virtual machine provisioning to web site deployment, particularly when dealing with several objects. A utility tool called AzCopy can even automate file management between Azure storage and your local workstation.

AzCopy is a stand-alone application that lets you manage Azure storage. Several procedures are possible using AzCopy. In this post, we’ll concentrate on:

  • Making containers for storage
  • Local file copying to containers
  • File transfer across containers

Let’s get started!

If you prefer to study via video, you may watch a TechSnips video that is closely linked to what you’ll learn in this article.



This article will provide a tour of several tasks. If you want to follow along, make sure you meet the conditions listed below before you begin.

Making New Containers for Storage

First, build new storage containers in an existing storage account using AzCopy. In the following example, you’ll create two new containers called container1 and container2.

Note: You must know the endpoint URL of a container before you can create it. https://[storageaccountname][container name] is the format for the endpoint URL.

Define the endpoint URL first. The containers will be created in a storage account named storageaccount1207, and two endpoint URLs will be generated:

Using the azcopy create command, supply each endpoint URL as a parameter, as shown below.

> azcopy make > azcopy make

In the storageaccount1207 storage account, creating new containersIn the storageaccount1207 storage account, creating new containers

Adding and removing files from Azure Containers

You’re undoubtedly wondering, “How do I upload to Azure Blob Storage?” once you’ve built a storage container. The azcopy copy command in AzCopy may help you do this. PSTs, VHDs, and other files may be copied using azcopy.

Authentication using OAuth

When copying files to blobs using AzCopy, you have a several authentication choices. You may just execute azcopy copy supplying a local file path followed by a container endpoint URL as shown below, since it is assumed you’ve already authenticated to Azure Storage (because it was in the requirements).

You are utilizing OAuth authentication by not giving any further parameters.

> azcopy copy c:myDirfile1.txt

Using OAuth, upload a file to Azure Storage.Using OAuth, upload a file to Azure Storage.

How do you tell whether the file has been moved to the Azure blob container? The command azcopy list [container url] may be used. The file1.txt file exists, as seen in the sample below.

> azcopy list

List the Azure blob container's contents.List the Azure blob container’s contents.

You just need to swap the source and destination parameters to download a file from an Azure blob to a local location. Consider the following example.

> azcopy copy>c:myDir

Download file from Azure Storage Authentication using OAuthDownload file from Azure Storage Authentication using OAuth

Using an SAS Token (Shared Access Signature)

You must first produce an SAS token before using it. Check visit the article How to Generate an Azure SAS Token to Access Storage Accounts if you don’t know how to generate an SAS token.

Once you have an SAS token, you may attach it as an HTTP parameter to the target container’s URL, as illustrated below.

> azcopy copy c:myDirfile1.txt ‘’

If you’re using PowerShell and have the token saved in a variable (e.g. $token), you may use it instead of the complete token string in the command below.

> azcopy copy c:myDirfile1.txt “$token”

Using SAS Token Authentication, copy the file to an Azure Container.Using SAS Token Authentication, copy the file to an Azure Container.

You may also download files from Azure storage to local storage using the same token (provided it is still valid). The sample below uses an SAS token to copy the file1.txt file from Azure storage.

Instead of attaching the token after the container name, the name of the file is appended first, as seen in the code below. This tells AzCopy to use SAS authentication to copy a specified file.

> azcopy copy (‘’+$token) C:MyDir

With SAS Token, copy a file from an Azure Container.With SAS Token, copy a file from an Azure Container.

Adding and removing directories from Azure Storage

If you have a large number of files to transfer or download from Azure, you may use azcopy copy to copy whole directories at once. The command for doing so is similar to the one for copying single files.

A command that replicates the C:MyDir recursively to the blob container container1 is shown below. The —recursive argument is crucial in this case. The —recursive parameter at the end of the command means that it will copy all items from the parent directory and any subdirectories that may exist.

> azcopy copy C:MyDir –recursive

Ten files from C: are listed below. According to the task summary, all of the files in the MyDir folder were successfully copied.

Copying the contents of a directoryCopying the contents of a directory

File Transfer Between Azure Storage Containers

You’ve used the azcopy copy command many times throughout this essay. There’s no need to quit right now! You may copy blobs between storage containers as well as directories and files to and from on-prem.

You’d alter the parameters to use one blob container URL as the source and another blob container URL as the destination instead of a local file path.

Container1 and container2 are two storage containers you’ve previously established. Let’s transfer files, folders, and even the whole blob container from container1 to container2 in this part.

Create a new SAS token before copying files from one container to another. Because the two containers are part of the same storage account, the source and destination tokens might be the same.

You may quickly transfer all data from one storage container to the other by saving the token string to a variable named $token (if using PowerShell to perform azcopy).

If you don’t know how to produce an Azure SAS token to access storage accounts, go to the article How to Generate an Azure SAS Token to Access Storage Accounts.

> azcopy copy (‘’+$token) (‘’+$token) –recursive

Using SAS Token authentication to transfer data between containersUsing SAS Token authentication to transfer data between containers

Additional AzCopy Operations

AzCopy can execute a variety of copy actions in addition to copying files and folders. Here are a few examples:

  • particular file copies (filtered).
  • In the blob container, copying a directory to another directory.
  • Amazon AWS to Azure Storage copying

If you want to understand more about what AzCopy can accomplish, use azcopy -h to see the help information. Apart from the copy command, which has been the subject of this essay, there are numerous more helpful commands. A screenshot of these instructions may be seen below.

AzCopy Commands ListAzCopy Commands List

Visit the AzCopy Copy website for additional information. Then, using the strategies you learned in this article, you may test them out on your own.


You learnt how to utilize AzCopy to move files between local and Azure storage in this post. You also learnt how to do similar operations while authenticating using OAuth and a Shared Access Signature Token. You’ve learned about the other AzCopy commands and how to locate them.

I hope this post has aroused your curiosity in utilizing AzCopy more in your administrative or development activities. Many thanks!

The “azcopy download” is a command-line tool that allows users to manage files between local and Azure Storage with AZCopy.

Related Tags

  • azcopy between storage accounts
  • azcopy sync
  • azcopy linux
  • azcopy command not found
  • how to use azcopy

Table of Content