Azure Blob Storage in Azure is a scalable, cost-effective solution for storing large amounts of unstructured data such as documents, images, and backups. One of the most efficient tools for interacting with Azure Blob Storage is AzCopy, a command-line utility that allows you to move and copy data to, from, and within Azure Storage accounts.
In this article, we will walk through the process of downloading files from Azure Blob Storage using AzCopy, including installation, authentication, and execution of download commands.
In my previous article File Uploading To Azure Blob Storage using AzCopy, I have explained for uploading files in different ways to Azure blob btorage using AzCopy. If you want to know, how to upload file then click on the link.
File Downloading From Azure Blob Storage Using AzCopy
Getting Started
AzCopy is a free command-line tool provided by Microsoft for high-performance data transfer. It supports data operations between your local machine and Azure Blob, File, and Table storage.
AzCopy Download
To use the AzCopy, you need to first download it, if you are Windows user then download AzCopy from the official Microsoft page. clic here to visit Microsoft official page.
Unzip the folder and add the path to your system’s environment variables. If you do not know how to add the AzCopy executable path to system environment in Windows, check the steps are given in the below of this article.
Use wget
or curl
to download AzCopy, unzip and move it to a directory in your $PATH.
wget https://aka.ms/downloadazcopy-v10-linux
Authenticate with Azure
There are two ways to authenticate AzCopy. The simplest for most users is Azure AD authentication and alternatively, you can use a Shared Access Signature (SAS) token appended to your storage URL if you prefer a script-based, non-interactive approach.
Authenticate with Azure AD (Interactive Login)
Use the azcopy login
command to autheticate the AzCopy with Azure using Azure AD. This opens a browser window where you can log in to your Azure account.
azcopy login
Download a Folder
To download a folder (virtual directory) from Azure Blob Storage using AzCopy copy
command, you can use the --recursive=true option.
azcopy copy 'https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-name>/<directory-path>' '<local-directory-path>' --recursive
Example
azcopy copy 'https://kailashsblogs.blob.core.windows.net/mycontainer/myBlobDirectory' 'C:\myDirectory' --recursive
This example creates a directory named C:\myDirectory\myBlobDirectory, which contains all the downloaded blobs.
Download Folder Contents
Using the wildcard symbol (*), you can download the contents of a directory without copying the directory itself.
Syntax azcopy copy 'https://<storage-account-name>.blob.core.windows.net/<container-name>/*' '<local-directory-path>/'
Example
azcopy copy 'https://kailashsblogs.blob.core.windows.net/mycontainer/myBlobDirectory/*' 'C:\myDirectory'
Use the --recursive flag to download files from all subdirectories like this.
azcopy copy 'https://kailashsblogs.blob.core.windows.net/mycontainer/myBlobDirectory/*' 'C:\myDirectory' --recursive
Download Blobs or Files
You can download blobs or files using complete file names, partial names with wildcard characters (*), or by specifying dates and times.
Download A File
Syntax azcopy copy "https://<storage-account-name>.blob.core.windows.net/<container-name>/<blob-name>?<SAS-token>" "<local-file-path>" --recursive=false
Example
azcopy copy "https://kailashsblogs.blob.core.windows.net/mycontainer/myfile.txt?<SAS-token>" "C:\Downloads\myfile.txt"
Download Multiple File Or Folder
To download multiple files or folders, use the azcopy copy command with the --include-path option, separating individual blob names with a semicolon (;).
Syntax azcopy copy 'https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-or-directory-name>' '<local-directory-path>' --include-path <semicolon-separated-file-list
Example
azcopy copy 'https://kailashsblogs.blob.core.windows.net/mycontainer/FileDirectory' 'C:\myDirectory' --include-path 'photos;documents\myFile.txt' --recursive
In this example, AzCopy transfers the folder and the file. Include the --recursive option to transfer all blobs in the photo folder
Download Files Using Wildcard
Multiple files that match the same pattern can be downloaded by using the azcopy copy
command with the --include-pattern
option. Specify partial names that include wildcard characters and separate them using a semicolon (;).
azcopy copy 'https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-or-directory-name>' '<local-directory-path>' --include-pattern <semicolon-separated-file-list-with-wildcard-characters>
Example
azcopy copy 'https://kailashsblogs.blob.core.windows.net/mycontainer/FileDirectory' 'C:\myDirectory' --include-pattern 'myFile*.txt;*.pdf*'
Download blobs that were modified before or after a date and time
Use the azcopy copy
command with the --include-before
or --include-after
option. Specify a date and time in ISO-8601 format (for example, 2020-08-19T15:04:00Z).
The following examples download files that were modified on or after the specified date.
Syntax zcopy copy 'https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-or-directory-name>/*' '<local-directory-path>' --include-after <Date-Time-in-ISO-8601-format>
Example
azcopy copy 'https://kailashsblogs.blob.core.windows.net/mycontainer/FileDirectory/*' 'C:\myDirectory' --include-after '2025-05-12T15:04:00Z'
Summary
AzCopy is a powerful utility for managing data transfers to and from Azure Blob Storage. Whether you're backing up data, syncing environments, or automating tasks, AzCopy simplifies the process of securely and efficiently downloading files from Azure. I hope you found this information helpful.
Thanks