AzCopy is a command-line utility that you can use to copy blobs or files to or from a storage account.
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)
- Linux ARM64 Preview (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.
ตรวจสอบเวอร์ชันบน Command prompts
> azcopy --version azcopy version 10.17.0
ตรวจสอบเวอร์ชันบน PowerShell
> .\azcopy --version azcopy version 10.17.0
ดู help
> azcopy --help AzCopy 10.17.0 Project URL: github.com/Azure/azure-storage-azcopy AzCopy is a command line tool that moves data into and out of Azure Storage. To report issues or to learn more about the tool, go to github.com/Azure/azure-storage-azcopy The general format of the commands is: 'azcopy [command] [arguments] --[flag-name]=[flag-value]'. Usage: azcopy [command] Available Commands: bench Performs a performance benchmark completion Generate the autocompletion script for the specified shell copy Copies source data to a destination location doc Generates documentation for the tool in Markdown format env Shows the environment variables that you can use to configure the behavior of AzCopy. help Help about any command jobs Sub-commands related to managing jobs list List the entities in a given resource login Log in to Azure Active Directory (AD) to access Azure Storage resources. logout Log out to terminate access to Azure Storage resources. make Create a container or file share. remove Delete blobs or files from an Azure storage account set-properties (Preview) Given a location, change all the valid system properties of that storage (blob or file) sync Replicate source to the destination location Flags: --cap-mbps float Caps the transfer rate, in megabits per second. Moment-by-moment throughput might vary slightly from the cap. If this option is set to zero, or it is omitted, the throughput isn't capped. -h, --help help for azcopy --log-level string Define the log verbosity for the log file, available levels: INFO(all requests/responses), WARNING(slow responses), ERROR(only failed requests), and NONE(no output logs). (default 'INFO'). (default "INFO") --output-level string Define the output verbosity. Available levels: essential, quiet. (default "default") --output-type string Format of the command's output. The choices include: text, json. The default value is 'text'. (default "text") --skip-version-check Do not perform the version check at startup. Intended for automation scenarios & airgapped use. --trusted-microsoft-suffixes string Specifies additional domain suffixes where Azure Active Directory login tokens may be sent. The default is '*.core.windows.net;*.core.chinacloudapi.cn;*.core.cloudapi.de;*.core.usgovcloudapi.net;*.storage.azure.net'. Any listed here are added to the default. For security, you should only put Microsoft Azure domains here. Separate multiple entries with semi-colons. -v, --version version for azcopy Use "azcopy [command] --help" for more information about a command.
Authorize AzCopy
You can provide authorization credentials by using Azure Active Directory (AD), or by using a Shared Access Signature (SAS) token.
Use this table as a guide:
Storage type | Currently supported method of authorization |
---|---|
Blob storage | Azure AD & SAS |
Blob storage (hierarchical namespace) | Azure AD & SAS |
File storage | SAS only |
Option 1: Use Azure Active Directory
ใช้คำสั่ง azcopy login
> azcopy login To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXXX to authenticate.
แล้วเปิด browser ไปที่ https://microsoft.com/devicelogin แล้วใส่ code
เลือก account เสร็จแล้ว จะมีหน้าถามว่า Are you trying to sign in to Azure Storage AzCopy? ให้กด Continue
กลับมาที่ terminal จะขึ้นว่า INFO: Login succeeded.
Option 2: Use a SAS token
You can append a SAS token to each source or destination URL that use in your AzCopy commands.
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 %LOCAL_PATH% %BLOB_PATH%?%SAS_KEY% --recursive=true
azcopy copy "C:\local\path" "https://account.blob.core.windows.net/mycontainer1/?sv=2018-xx-xx&ss...e=2019-05-01T05:01:17Z&st=2019-xx-xx....4%3D" --recursive=true
เมื่อทำงานเสร็จก็ logout
> azcopy logout INFO: Logout succeeded.