Overview of AzCopy

  1. Home
  2. Overview of AzCopy

AzCopy is a command-line utility developed by Microsoft that allows users to copy data to and from Azure storage accounts, as well as between Azure storage accounts. It is available for Windows, Linux, and macOS operating systems.

Some of the key features of AzCopy include:

  1. High-performance data transfer: AzCopy uses efficient, multi-threaded algorithms to transfer data at high speed.
  2. Support for various data sources and destinations: AzCopy supports copying data from and to various data sources and destinations, including Azure Blob storage, Azure File storage, Azure Table storage, and Azure Data Lake Storage.
  3. Support for large-scale data transfer: AzCopy can handle large-scale data transfers, including transfers of multiple terabytes of data.
  4. Support for incremental transfers: AzCopy can be configured to perform incremental transfers, which only transfer data that has changed since the last transfer.
  5. Support for access control: AzCopy allows users to control access to their data by specifying access policies, SAS (Shared Access Signature) tokens, and storage account keys.
  6. Support for scripting: AzCopy can be used in scripts to automate data transfer tasks.

Overall, AzCopy is a powerful and versatile tool that can simplify data transfer to and from Azure storage accounts.

Let update the knowledge with some Sample Questions:

  1. What is AzCopy?
    A. A graphical user interface (GUI) tool for managing Azure storage accounts.
    B. A command-line utility for copying data to and from Azure storage accounts.
    C. An SDK for building Azure applications.
    D. A tool for managing virtual machines in Azure.
  2. Which operating systems is AzCopy available for?
    A. Windows only.
    B. Linux only.
    C. macOS only.
    D. Windows, Linux, and macOS.
  3. What types of Azure storage does AzCopy support?
    A. Azure Blob storage only.
    B. Azure File storage only.
    C. Azure Table storage only.
    D. Azure Blob storage, Azure File storage, Azure Table storage, and Azure Data Lake
  4. What is one key feature of AzCopy?
    A. It is a low-cost alternative to other data transfer tools.
    B. It can only handle small-scale data transfers.
    C. It can only be used by advanced users with coding experience.
    D. It can perform high-performance data transfer at scale.
  5. Can AzCopy be used in scripts to automate data transfer tasks?
    A. Yes
    B. No

Answers:

  1. B. A command-line utility for copying data to and from Azure storage accounts.
  2. D. Windows, Linux, and macOS.
  3. D. Azure Blob storage, Azure File storage, Azure Table storage, and Azure Data Lake Storage.
  4. D. It can perform high-performance data transfer at scale.
  5. A. Yes

Now, that you understand the three major steps, it’s time to dive into providing you with a better understanding.

Downloading AzCopy

First, download the AzCopy V10 file to your computer. Also, remember, AzCopy V10 is just an executable file. So, there is no need to install.

Running AzCopy

In order to run the AzCopy, follow the following steps:

  • First of all, add the directory location of the AzCopy executable to your system path for ease of use. 
  • Then type azcopy -h and then press the ENTER key.
AzCopy
Source: Microsoft

Your next step is to choose from authorization credentials. For this, you have two options, which include:

  • Firstly, using Azure Active Directory
  • Secondly, using a SAS token

Option 1: Using Azure Active Directory

By utilising Azure Active Directory, you can present credentials once instead of having to append a SAS token to each command. The level of authorization that you require is based on your plan to upload files or download them.

In case you wish to download files, then prove that the Storage Blob Data Reader is assigned to your user identity, managed identity, or service principal.

And, if you desire to upload files, then confirm that one of the below-mentioned roles is assigned to your security principal:

  • Firstly, Storage Blob Data Contributor
  • Secondly, Storage Blob Data Owner

Further, these roles can be allocated to your security principal in any of these scopes:

  • First of all, the container (file system)
  • Secondly, the storage account
  • Subsequently, the resource group
  • Lastly, the subscription
Authenticate a user identity

After verifying the necessary authorization level, open a command prompt, type the following command, and then press the ENTER key.

azcopy login

Authenticate a service principal
  • If you intend to use AzCopy inside of a script that runs without user interaction, particularly when running on-premises.
  • If you intend to run AzCopy on VMs that run in Azure, a managed service identity is easier to administer.
Using a client secret
  • Begin by setting the AZCOPY_SPA_CLIENT_SECRET environment variable to the client secret of your service principal’s app registration.
  • $env:AZCOPY_SPA_CLIENT_SECRET=”$(Read-Host -prompt “Enter key”)”
Using a certificate
  • If you prefer to use your own credentials for authorization, you can upload a certificate to your app registration, and then use that certificate to log in.
  • Next, set the AZCOPY_SPA_CERT_PASSWORD environment variable to the certificate password.
Authenticate a managed identity
  • This is a great option if you intend to utilise AzCopy inside of a script that runs without user interaction, and the script runs from an Azure Virtual Machine (VM). 
  • Also, while using this option, you won’t have to store any credentials on the VM.
Using a system-wide managed identity
  • First, enable a system-wide managed identity on your VM. 
  • Then, type the following command in your command console, and then press the ENTER key.
  • azcopy login –identity
Practice Test for AZ-104
Using a user-assigned managed identity
  • First, enable a user-assigned managed identity on your VM. 
  • Then, type any of the following commands, in your command console, and then press the ENTER key.

Option 2: Use a SAS token

You can add a SAS token to each source or destination URL that use in your AzCopy commands.

Transfer files

After authenticating your identity or received a SAS token, begin transferring files.

Use AzCopy in a script
  • Obtain a static download link
  • Escape special characters in SAS tokens
  • Run scripts by using Jenkins
AzCopy
Source: Microsoft
Use AzCopy in Azure Storage Explorer
  • Storage Explorer utilises AzCopy to perform all of its data transfer operations. 
  • You can use Storage Explorer if you need to leverage the performance advantages of AzCopy.
AzCopy

Reference: Microsoft Documentation

Return to AZ-104 Tutorial

Menu