Share via


az storage azcopy blob

Note

This reference is part of the storage-preview extension for the Azure CLI (version 2.70.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

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

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

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
--target -t

The delete target path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

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

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

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

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
--source -s

The download source path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

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

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

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

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

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

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

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

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--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.

Property Value
Parameter group: Storage Account Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False