AzCopy, Azure

AZCopy

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.

Microsoft Documentation

Download here: https://aka.ms/downloadazcopy-v10-windows

The download has the zip that contains the azcopy executable. Download, extract and move the executable to some folder on your system and add its location to the system path for convenience.

Based on what you need to do you will probably require some metadata/information from your azure portal. In this article I’ll be showing example on how to:

  • Copy files from local to a blob container in azure
  • Copy files from one container to another.

You can use following powershell commands to get some of this information:

  1. Login to your azure account: Connect-AzureRmAccount. This will launch a window for you to provide your azure credentials.  If successful you should get following information in the response:
    • Account
    • Subscription Name
    • Subscription Id
    • Tenant Id
    • Environment
  2. Get list of storage accounts in your account: Get-AzureRmStorageAccount
    • Or create a new storage account using New-AzureRmStorageAccount

Using AzCopy

  1. To use azcopy first you need to login to azure. Run following command:
    • azcopy login –tenant-id “<Tenant Id from step 1.d>”
  2. Next you will need to provision a blob container in your storage account to hold the files you’re copying. You can create container using following command:
    • azcopy make https://<storage account name>.blob.core.windows.net/<container name>
  3. Copy files (from local):
    • azcopy copy “<Local system path to folder containing files>\*” https://<storage account name>.blob.core.windows.net/<container name>/
    • If you would like to copy all folders and files under them then add –recursive flag
  4. Copy files (from container)
    • When you copy files from one container to another then you need to pass Shared Access Signature (SAS) token from the source container.
    • SAS token can be created from Storage Account -> Shared Access Signature
    • azcopy copyhttps://<source storage>.blob.core.windows.net/<source container>/?<SAS Token>” “https://<target storage>.blob.core.windows.net/<target container>/” –recursive

Some other useful links for reference:

Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s