Installing the AzCopy & Azure CLI
  • 05 Jul 2024
  • 3 Minutes to read
  • PDF

Installing the AzCopy & Azure CLI

  • PDF

Article summary

The Azure Command Line Interface (Azure CLI) is a command-line tool to manage your Azure resources through a set of commands on your local computer's command line. Similarly, AzCopy is a command-line utility created by Azure as a tool designed to list and copy blobs from a storage account. Bobsled recommends using AzCopy to view and consume shares and data transfers.

Within Bobsled, you may authenticate with the Azure CLI and/or AzCopy to interact with both Bobsled-managed Azure Blob Storage resources and resources within your own account.

For more information about, visit Azure CLI ↗ and AzCopy ↗


Install AzCopy

For Windows

The easiest way to install AzCopy for Windows is via a PowerShell Script. The provided script is a quick way to download the required AzCopy executable file and add it to your system path, insuring that you are able to execute AzCopy from any location on your command-line. You can find each step in the comments of the script. If you would like to manually download the zip file yourself and execute AzCopy from a specific directory location, refer to "Other Systems" section below.

  1. Click Start icon on your Windows computer

  2. Search "Notepad" and create a new text file

  3. Copy and paste the script below into your text file. Save file to your desired location with a '.ps1' file type.

    $InstallPath = 'C:\AzCopy'
    
    # Cleanup Destination
    if (Test-Path $InstallPath) {
        Get-ChildItem $InstallPath | Remove-Item -Confirm:$false -Force
    }
    
    # Zip Destination
    $zip = "$InstallPath\AzCopy.Zip"
    
    # Create the installation folder (eg. C:\AzCopy)
    $null = New-Item -Type Directory -Path $InstallPath -Force
    
    # Download AzCopy zip for Windows
    Start-BitsTransfer -Source "https://aka.ms/downloadazcopy-v10-windows" -Destination $zip
    
    # Expand the Zip file
    Expand-Archive $zip $InstallPath -Force
    
    # Move to $InstallPath
    Get-ChildItem "$($InstallPath)\*\*" | Move-Item -Destination "$($InstallPath)\" -Force
    
    #Cleanup - delete ZIP and old folder
    Remove-Item $zip -Force -Confirm:$false
    Get-ChildItem "$($InstallPath)\*" -Directory | ForEach-Object { Remove-Item $_.FullName -Recurse -Force -Confirm:$false }
    
    # Add InstallPath to the System Path if it does not exist
    if ($env:PATH -notcontains $InstallPath) {
        $path = ($env:PATH -split ";")
        if (!($path -contains $InstallPath)) {
            $path += $InstallPath
            $env:PATH = ($path -join ";")
            $env:PATH = $env:PATH -replace ';;', ';'
        }
        [Environment]::SetEnvironmentVariable("Path", ($env:path), [System.EnvironmentVariableTarget]::Machine)
    
    #Test if install worked. Should see azcopy.exe utility and a license text file
    Get-ChildItem -Path $InstallPath
    }
    Read-Host -Prompt "Press Enter to exit"

  4. In the file Explorer, find the script file. Right click on the file and select "Run with PowerShell" to execute the file in PowerShell

  5. To check if AzCopy was successfully installed, you should see the "azcopy.exe" utility and a license text file in the PowerShell output.


For Mac and Linux

The easiest way to install AzCopy on Mac or Linux is using Homebrew, a missing package manager. If you do not have Homebrew installed, visit: Install Homebrew. 

  1. Run the below command in your terminal to install AzCopy. Visit azcopy Homebrew ↗ for more information

    brew install azcopy
  2. To check if AzCopy was successfully installed, run the following command in your terminal

    azcopy -v

    The output should look something like: "azcopy version 10.16.2"


For other systems

To use AzCopy with all other systems, you will download the AzCopy zip file for your operating system. AzCopy is an executable file, so no need to install anything.

  1. Visit Download AzCopy ↗

  2. Select your operating system and download zip file

  3. Extract zip file and save folder to an easily accessible location. Please keep in mind that you will need to execute the AzCopy folder from the command-line, it is recommended to save to "Home" directory and/or add the folder's path to your System Path for ease of use.

  4. To navigate into your folder on your computers command-line you may:

    • Search for the downloaded folder in your file explorer and right click on the folder. 

    • Use "cd" (change directory) command on the command-line to navigate into folder

  5. Once you have your command-line open at the folder location, you will be able to execute AzCopy commands from within this folder



Install the Azure CLI

1. To install the Azure CLI, please visit Install Azure CLI ↗ and choose your operating system.

TIP :
Not sure if you have the Azure CLI installed?

  • For MacOS and Linux users, open your terminal;

  • For PC users, open your command prompt.

Run the command "az -v" on your computer's command-line. The output should look something like: "azure-cli 3.40.0". If you receive this output you have the Azure CLI installed. .


Was this article helpful?