Skip to content

AzCopy and Storage Tools

Scott Duffy Lectures 15-16 AZ-104

Overview

Azure provides several tools for transferring and managing files in storage accounts beyond the portal's built-in upload button. The portal UI works for one-off uploads, but it is not the most efficient approach for bulk operations, cross-account transfers, or automation. This page covers AzCopy (the primary CLI transfer tool), Storage Browser (web-based file manager), and Azure Storage Explorer (desktop application), along with native SMB mounting for file shares.

Key Takeaway

AzCopy is the go-to tool for efficient, scriptable, bulk file transfers to and from Azure Storage. Storage Browser and Storage Explorer provide GUI-based file management for ad-hoc operations. Choose the right tool based on whether you need automation, GUI convenience, or native OS integration.

AzCopy

What Is AzCopy?

AzCopy is a standalone command-line utility for copying data to and from Azure Blob Storage, Azure Files, and Azure Table Storage. It is a separate download -- not bundled with the Azure CLI or PowerShell modules.

  • Latest version: AzCopy V10 (stable for many years, still current)
  • Platforms: Windows, Linux, macOS
  • Standalone binary: No runtime dependencies, single executable
  • Use cases: Upload files to storage, download from storage, copy between storage accounts, synchronize directories, list and remove blobs

Installation

bash
# Download and install AzCopy
wget https://aka.ms/downloadazcopy-v10-linux \
  && tar -xvf downloadazcopy-v10-linux \
  && sudo cp ./azcopy_linux_amd64_*/azcopy /usr/bin/

# Verify installation
azcopy --version
bash
# Install via Homebrew
brew install azcopy

# Verify installation
azcopy --version
powershell
# Install via winget
winget install Microsoft.AzCopy

# Verify installation
azcopy --version

Authentication Methods

AzCopy supports two primary authentication methods:

MethodHow It WorksBest For
Entra ID (RBAC)Run azcopy login, authenticate via browser, permissions come from role assignments (e.g., Storage Blob Data Contributor)Interactive use, long-running sessions, role-based access
SAS TokenGenerate a SAS token with appropriate permissions and expiry, append it to the storage URLScripted/automated transfers, time-limited access, cross-account copies

Entra ID vs SAS

With Entra ID, you log in once and AzCopy caches credentials for the session. With SAS tokens, you embed the token directly in the destination URL -- no login step required, but the token has a fixed expiry window.

SAS Token Workflow for AzCopy

When using SAS tokens with AzCopy, the workflow involves generating a token in the portal and embedding it in the command:

  1. Navigate to the destination container in the Azure Portal
  2. Generate a SAS token with full permissions (read, write, delete, list), a reasonable expiry (e.g., 6 hours), and HTTPS only
  3. Copy the full URL including the storage account name, container path, and the SAS query string
  4. Use the URL as the destination in the azcopy copy command

Command Syntax

The core AzCopy command structure is:

azcopy copy <source> <destination>

The source and destination can be local paths or Azure Storage URLs (with SAS tokens or after Entra ID login).

Example from the lecture -- uploading a local MP4 file to a blob container using a SAS token:

bash
azcopy copy "C:\Users\User\Videos\sample.mp4" \
  "https://account.blob.core.windows.net/destination?sv=...&sig=..."

AzCopy displays transfer progress during execution, including bytes transferred and completion status. The file appears in the destination container immediately upon completion.

AzCopy Transfer Patterns

txt
direction: right

local: Local Machine {
  shape: rectangle
  style.fill: "#2563eb"
  style.font-color: "#fff"
}

blob1: Azure Blob Storage\n(Account A) {
  shape: rectangle
  style.fill: "#16a34a"
  style.font-color: "#fff"
}

blob2: Azure Blob Storage\n(Account B) {
  shape: rectangle
  style.fill: "#16a34a"
  style.font-color: "#fff"
}

s3: AWS S3 Bucket {
  shape: rectangle
  style.fill: "#f59e0b"
  style.font-color: "#fff"
}

local -> blob1: Upload files
blob1 -> local: Download files
blob1 -> blob2: Cross-account copy
s3 -> blob1: Migrate from S3

Common AzCopy Commands

bash
# Login with Entra ID
azcopy login

# Copy a single file to blob storage
azcopy copy "/path/to/file.txt" \
  "https://account.blob.core.windows.net/container/file.txt?SAS"

# Recursive directory upload
azcopy copy "/path/to/dir" \
  "https://account.blob.core.windows.net/container?SAS" \
  --recursive

# Sync local directory with container (only copy changed files)
azcopy sync "/path/to/dir" \
  "https://account.blob.core.windows.net/container?SAS"

# Copy between storage accounts (server-side)
azcopy copy \
  "https://source.blob.core.windows.net/container?SAS" \
  "https://dest.blob.core.windows.net/container?SAS" \
  --recursive

# List blobs in a container
azcopy list "https://account.blob.core.windows.net/container?SAS"

# Remove a blob
azcopy remove "https://account.blob.core.windows.net/container/blob?SAS"

# Benchmark transfer performance
azcopy benchmark "https://account.blob.core.windows.net/container?SAS"
powershell
# Login with Entra ID
azcopy login

# Copy a single file to blob storage
azcopy copy "C:\Data\file.txt" `
  "https://account.blob.core.windows.net/container/file.txt?SAS"

# Recursive directory upload
azcopy copy "C:\Data\mydir" `
  "https://account.blob.core.windows.net/container?SAS" `
  --recursive

# Sync local directory with container
azcopy sync "C:\Data\mydir" `
  "https://account.blob.core.windows.net/container?SAS"

# Copy between storage accounts
azcopy copy `
  "https://source.blob.core.windows.net/container?SAS" `
  "https://dest.blob.core.windows.net/container?SAS" `
  --recursive

# List blobs in a container
azcopy list "https://account.blob.core.windows.net/container?SAS"

# Remove a blob
azcopy remove "https://account.blob.core.windows.net/container/blob?SAS"

# Benchmark transfer performance
azcopy benchmark "https://account.blob.core.windows.net/container?SAS"

AzCopy Operations Summary

OperationCommandDescription
Uploadazcopy copy <local> <remote>Copy files from local machine to blob storage
Downloadazcopy copy <remote> <local>Copy files from blob storage to local machine
Server-side copyazcopy copy <remote1> <remote2>Copy between storage accounts without downloading locally
Syncazcopy sync <source> <dest>Only transfer changed/new files (like rsync)
Listazcopy list <remote>List blobs in a container
Removeazcopy remove <remote>Delete blobs from storage
Benchmarkazcopy benchmark <remote>Test upload performance to a container

Performance Tuning

AzCopy performance can be tuned with environment variables:

Environment VariableDescriptionDefault
AZCOPY_CONCURRENCY_VALUENumber of concurrent transfersAuto-detected based on CPU cores
AZCOPY_BUFFER_GBBuffer size for download/upload operationsAuto-detected based on available memory
bash
# Example: increase concurrency for high-bandwidth connections
export AZCOPY_CONCURRENCY_VALUE=32
export AZCOPY_BUFFER_GB=4

azcopy copy "/path/to/largedir" \
  "https://account.blob.core.windows.net/container?SAS" \
  --recursive

Advantages Over the Portal UI

  • Batch operations -- upload or download entire directories recursively
  • Scriptable -- integrate into shell scripts, CI/CD pipelines, scheduled tasks
  • Faster for large files -- direct transfer without browser overhead
  • Automation-friendly -- combine with cron jobs or Windows Task Scheduler
  • Cross-account copies -- server-side copy between accounts without downloading locally
  • Sync capability -- only transfer changed files, reducing bandwidth and time

Storage Browser (Azure Portal)

What Is Storage Browser?

Storage Browser is a web-based file manager built into the Azure Portal. It is located on the left sidebar of each storage account and provides a unified view of all storage services.

Functionality

  • Blob containers -- browse, upload, download, and manage blobs
  • File shares -- browse directories and files within Azure Files
  • Queues -- view and manage queue messages
  • Tables -- browse table entities
  • Copy and paste -- copy a file from one container and paste it into another container
  • Clone -- duplicate a file within the same or different container (available from the three-dots menu)
  • Cross-container operations -- select a file, copy, navigate to a different container, paste

SAS Token Generation

Storage Browser can generate SAS tokens for specific files directly from the three-dots context menu:

  • Select a file, click the three-dots menu, choose Generate SAS
  • Configure permissions and expiry, then generate the token

Key Requirement

SAS generation from Storage Browser requires storage account key access to be enabled. If key access has been disabled (Entra-only accounts), the SAS generation option will not work. You will see an error indicating that the key is not available.

Azure Storage Explorer (Desktop App)

What Is Storage Explorer?

Azure Storage Explorer is a free, standalone desktop application that provides a graphical interface for managing Azure Storage resources. It offers similar functionality to Storage Browser but runs as a native application on your machine.

Connection Methods

Storage Explorer supports multiple authentication and connection methods:

MethodDescription
Entra IDSign in with your Azure account, access governed by RBAC
Account keyConnect using the storage account access key
SAS URIPaste a SAS URL to connect to a specific container or blob
Connection stringUse the full connection string from the storage account

Advantages and Disadvantages

AspectDetail
AdvantagesDesktop app, potentially faster UI, persistent connection, supports all storage services
DisadvantagesSeparate installation required, must be kept updated

Screenshot

Storage Account Navigation Menu

Storage account navigation menu showing AzCopy and storage tools context

File Share Access Alternatives

Azure file shares can be accessed through multiple methods beyond the portal:

  • Native SMB mount -- mount the file share as a drive letter (Windows) or mount point (Linux) using standard OS tools
  • Storage Browser -- web-based management through the Azure Portal
  • Storage Explorer -- desktop application for graphical file management
  • AzCopy -- command-line transfers for bulk operations

Tool Comparison

FeatureStorage BrowserStorage ExplorerNative SMBAzCopy
AccessWeb portalDesktop appNative OSCLI
Copy/pasteYesYesNative toolsYes
SAS generationYes (if keys enabled)YesNoN/A (consumer)
InstallationNoneRequiredVia OSRequired
Bulk operationsLimitedGoodGoodBest
AutomationNoLimitedScriptableBest
PlatformAll (web browser)Win/Mac/LinuxWin/LinuxWin/Mac/Linux

Choosing the Right Tool

Decision Guide

  • One-off file browsing or copy/paste -- use Storage Browser in the portal (zero install)
  • Regular file management with a GUI -- install Azure Storage Explorer
  • Bulk uploads, migrations, or scheduled transfers -- use AzCopy
  • Application-level file access -- mount the file share via SMB
  • CI/CD pipeline integration -- AzCopy with SAS tokens or managed identity

Lab: AzCopy and Storage Tools

Step 1 -- Install AzCopy on your machine
bash
# Linux
wget https://aka.ms/downloadazcopy-v10-linux \
  && tar -xvf downloadazcopy-v10-linux \
  && sudo cp ./azcopy_linux_amd64_*/azcopy /usr/bin/

# macOS
brew install azcopy

# Windows (PowerShell)
winget install Microsoft.AzCopy

# Verify installation on any platform
azcopy --version
Step 2 -- Authenticate with Entra ID or generate a SAS token
bash
# Option A: Login with Entra ID (interactive browser login)
azcopy login

# Option B: Generate a SAS token from the portal
# 1. Navigate to your storage account > Containers > your-container
# 2. Click "Shared access tokens"
# 3. Set permissions: Read, Write, Delete, List
# 4. Set expiry: 6 hours from now
# 5. Set protocol: HTTPS only
# 6. Click "Generate SAS token and URL"
# 7. Copy the "Blob SAS URL"

# Store the SAS URL in a variable for convenience
SAS_URL="https://<account>.blob.core.windows.net/<container>?sv=...&sig=..."
Step 3 -- Upload a single file to blob storage
bash
# Create a test file
echo "AzCopy lab test file - $(date)" > /tmp/azcopy-test.txt

# Upload using SAS token
azcopy copy "/tmp/azcopy-test.txt" "${SAS_URL}"

# Or with Entra ID (no SAS needed)
azcopy copy "/tmp/azcopy-test.txt" \
  "https://<account>.blob.core.windows.net/<container>/azcopy-test.txt"

# Verify the upload
azcopy list "${SAS_URL}"

Observe the transfer progress output: bytes transferred, elapsed time, and completion status.

Step 4 -- Upload a directory recursively
bash
# Create a test directory with multiple files
mkdir -p /tmp/azcopy-lab/{subdir1,subdir2}
echo "File A" > /tmp/azcopy-lab/file-a.txt
echo "File B" > /tmp/azcopy-lab/subdir1/file-b.txt
echo "File C" > /tmp/azcopy-lab/subdir2/file-c.txt

# Upload the entire directory recursively
azcopy copy "/tmp/azcopy-lab" "${SAS_URL}" --recursive

# List to verify all files are uploaded
azcopy list "${SAS_URL}"
Step 5 -- Sync a local directory with a container
bash
# Add a new file to the local directory
echo "File D - added after initial upload" > /tmp/azcopy-lab/file-d.txt

# Sync only uploads new or changed files
azcopy sync "/tmp/azcopy-lab" "${SAS_URL}"

# Verify the new file was uploaded without re-uploading existing files
azcopy list "${SAS_URL}"

Note how sync only transfers file-d.txt -- existing unchanged files are skipped.

Step 6 -- Use Storage Browser to copy a file between containers
  1. Navigate to your storage account in the Azure Portal
  2. Click Storage Browser in the left sidebar
  3. Expand Blob containers and open the source container
  4. Select a file, click the three-dots menu, choose Copy
  5. Navigate to a different container (create one if needed)
  6. Click Paste in the toolbar
  7. Verify the file appears in the destination container

This demonstrates the cross-container copy/paste functionality that is unique to Storage Browser compared to the standard container view.

Step 7 -- (Optional) Install Azure Storage Explorer and connect
  1. Download Azure Storage Explorer from https://azure.microsoft.com/products/storage/storage-explorer/
  2. Install and launch the application
  3. Click Add an account and choose your preferred connection method:
    • Entra ID -- sign in with your Azure credentials
    • SAS URI -- paste a SAS URL
    • Connection string -- paste from the portal
  4. Browse your storage account, containers, file shares, queues, and tables
  5. Try copying a file between containers using the desktop interface

Microsoft Learn References

Released under the MIT License.