Share via


az storage azcopy blob

Note

This reference is part of the storage-preview extension for the Azure CLI (version 2.61.0 or higher). The extension will automatically install the first time you run an az storage azcopy blob command. Learn more about extensions.

Manage object storage for unstructured data (blobs) using AzCopy.

Commands

Name Description Type Status
az storage azcopy blob delete

Delete blobs from a storage blob container using AzCopy.

Extension GA
az storage azcopy blob download

Download blobs from a storage blob container using AzCopy.

Extension GA
az storage azcopy blob sync

Sync blobs recursively to a storage blob container using AzCopy.

Extension GA
az storage azcopy blob upload

Upload blobs to a storage blob container using AzCopy.

Extension GA

az storage azcopy blob delete

Delete blobs from a storage blob container using AzCopy.

az storage azcopy blob delete --container
                              [--account-key]
                              [--account-name]
                              [--auth-mode {key, login}]
                              [--connection-string]
                              [--recursive]
                              [--sas-token]
                              [--target]

Examples

Delete a single blob from a container.

az storage azcopy blob delete -c MyContainer --account-name MyStorageAccount -t TargetBlob

Delete all blobs from a container.

az storage azcopy blob delete -c MyContainer --account-name MyStorageAccount --recursive

Delete all blobs in a virtual directory.

az storage azcopy blob delete -c MyContainer --account-name MyStorageAccount -t "path/to/virtual_directory" --recursive

Required Parameters

--container -c

The delete target container.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--recursive -r

Recursively delete blobs.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--target -t

The delete target path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage azcopy blob download

Download blobs from a storage blob container using AzCopy.

az storage azcopy blob download --container
                                --destination
                                [--account-key]
                                [--account-name]
                                [--auth-mode {key, login}]
                                [--connection-string]
                                [--recursive]
                                [--sas-token]
                                [--source]

Examples

Download a single blob from a container.

az storage azcopy blob download -c MyContainer --account-name MyStorageAccount -s "path/to/blob" -d "path/to/file"

Download a virtual directory from a container.

az storage azcopy blob download -c MyContainer --account-name MyStorageAccount -s "path/to/virtual_directory" -d "download/path" --recursive

Download the contents of a container onto a local file system.

az storage azcopy blob download -c MyContainer --account-name MyStorageAccount -s * -d "download/path" --recursive

Required Parameters

--container -c

The download source container.

--destination -d

The destination file path to download to.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--recursive -r

Recursively download blobs.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--source -s

The download source path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage azcopy blob sync

Sync blobs recursively to a storage blob container using AzCopy.

az storage azcopy blob sync --container
                            --source
                            [--account-key]
                            [--account-name]
                            [--auth-mode {key, login}]
                            [--connection-string]
                            [--destination]
                            [--sas-token]

Examples

Sync a single blob to a container.

az storage azcopy blob sync -c MyContainer --account-name MyStorageAccount -s "path/to/file" -d NewBlob

Sync a directory to a container.

az storage azcopy blob sync -c MyContainer --account-name MyStorageAccount -s "path/to/directory"

Required Parameters

--container -c

The sync destination container.

--source -s

The source file path to sync from.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--destination -d

The sync destination path.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage azcopy blob upload

Upload blobs to a storage blob container using AzCopy.

az storage azcopy blob upload --container
                              --source
                              [--account-key]
                              [--account-name]
                              [--auth-mode {key, login}]
                              [--connection-string]
                              [--destination]
                              [--recursive]
                              [--sas-token]

Examples

Upload a single blob to a container.

az storage azcopy blob upload -c MyContainer --account-name MyStorageAccount -s "path/to/file" -d NewBlob

Upload a directory to a container.

az storage azcopy blob upload -c MyContainer --account-name MyStorageAccount -s "path/to/directory" --recursive

Upload the contents of a directory to a container.

az storage azcopy blob upload -c MyContainer --account-name MyStorageAccount -s "path/to/directory/*" --recursive

Required Parameters

--container -c

The upload destination container.

--source -s

The source file path to upload from.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--destination -d

The upload destination path.

--recursive -r

Recursively upload blobs.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.