AzCopy is a command-line utility that you can use to copy blobs or files to or from a storage account. This article helps you download AzCopy, connect to your storage account, and then transfer files. Following steps are mentioned for transferring data to and from an Azure Blob Storage
Download AzCopy
First, download the AzCopy V10 executable file to any directory on your computer. AzCopy V10 is just an executable file, so there's nothing to install.
- Windows 64-bit (zip)
- Windows 32-bit (zip)
- Linux x86-64 (tar)
- macOS (zip)
These files are compressed as a zip file (Windows and Mac) or a tar file (Linux). To download and decompress the tar file on Linux, see the documentation for your Linux distribution.
Run AzCopy
For convenience, consider adding the directory location of the AzCopy executable to your system path for ease of use. That way you can type azcopy from any directory on your system.
Authorize AzCopy
You can provide authorization credentials by using Azure Active Directory (AD), or by using a Shared Access Signature (SAS) token. In this article, we would discuss the method of SAS token
To see a list of all commands use following in PowerShell
azcopy -h
Upload Data from Local Directory to Azure Blob
This example command recursively copies data from a local directory to a blob container. A fictitious SAS token is appended to the end of the container URL.
azcopy copy "C:\local\path" "https://account.blob.core.windows.net/mycontainer1/?sv=2018-03-28&ss=bjqt&srt=sco&sp=rwddgcup&se=2019-05-01T05:01:17Z&st=2019-04-30T21:01:17Z&spr=https&sig=MGCXiyEzbtttkr3ewJIh2AR8KrghSy1DGM9ovN734bQF4%3D" --recursive=true
Download Blob Containers and Directories
You can download blobs and directories from Blob storage by using the AzCopy v10 command-line utility.
Mentioned below are the commands that we have tested to download content from a directory 'test', in azure blob storage container, to a directory 'blob' in drive e.
For Powershell:
.\azcopy copy "https://storageaccountname.blob.core.windows.net/test?SAS Token" "e:/blob/" --recursive
For Command Prompt:
azcopy copy "https://storageaccountname.blob.core.windows.net/test?SAS Token" 'e:/blob/' --recursive
SAS Token should be obtained from Access control section of the Azure Storage Account
Reference: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10
Comments
0 comments
Please sign in to leave a comment.