az storage blob

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage object storage for unstructured data (blobs).

Please specify one of the following authentication parameters for your commands: --auth- mode, --account-key, --connection-string, --sas-token. You also can use corresponding environment variables to store your authentication credentials, e.g. AZURE_STORAGE_KEY, AZURE_STORAGE_CONNECTION_STRING and AZURE_STORAGE_SAS_TOKEN.

Commands

Name Description Type Status
az storage blob copy

Manage blob copy operations. Use az storage blob show to check the status of the blobs.

Core and Extension GA
az storage blob copy cancel

Abort an ongoing copy operation.

Core GA
az storage blob copy start

Copy a blob asynchronously. Use az storage blob show to check the status of the blobs.

Core GA
az storage blob copy start (storage-blob-preview extension)

Start a copy blob job.

Extension GA
az storage blob copy start-batch

Copy multiple blobs to a blob container. Use az storage blob show to check the status of the blobs.

Core GA
az storage blob delete

Mark a blob or snapshot for deletion.

Core GA
az storage blob delete (storage-blob-preview extension)

Mark a blob or snapshot for deletion.

Extension GA
az storage blob delete-batch

Delete blobs from a blob container recursively.

Core GA
az storage blob download

Download a blob to a file path.

Core GA
az storage blob download-batch

Download blobs from a blob container recursively.

Core GA
az storage blob exists

Check for the existence of a blob in a container.

Core GA
az storage blob filter

List blobs across all containers whose tags match a given search expression.

Extension Preview
az storage blob generate-sas

Generate a shared access signature for the blob.

Core GA
az storage blob generate-sas (storage-blob-preview extension)

Generate a shared access signature for the blob.

Extension GA
az storage blob immutability-policy

Manage blob immutability policy.

Core GA
az storage blob immutability-policy delete

Delete blob's immutability policy.

Core GA
az storage blob immutability-policy set

Set blob's immutability policy.

Core GA
az storage blob incremental-copy

Manage blob incremental copy operations.

Core GA
az storage blob incremental-copy cancel

Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata.

Core GA
az storage blob incremental-copy start

Copies an incremental copy of a blob asynchronously.

Core GA
az storage blob lease

Manage storage blob leases.

Core GA
az storage blob lease acquire

Request a new lease.

Core GA
az storage blob lease break

Break the lease, if the container or blob has an active lease.

Core GA
az storage blob lease change

Change the lease ID of an active lease.

Core GA
az storage blob lease release

Release the lease.

Core GA
az storage blob lease renew

Renew the lease.

Core GA
az storage blob list

List blobs in a given container.

Core GA
az storage blob metadata

Manage blob metadata.

Core GA
az storage blob metadata show

Return all user-defined metadata for the specified blob or snapshot.

Core GA
az storage blob metadata update

Sets user-defined metadata for the blob as one or more name-value pairs.

Core GA
az storage blob query

Enable users to select/project on blob or blob snapshot data by providing simple query expressions.

Core Preview
az storage blob restore

Restore blobs in the specified blob ranges.

Core GA
az storage blob rewrite

Create a new Block Blob where the content of the blob is read from a given URL.

Core Preview
az storage blob service-properties

Manage storage blob service properties.

Core and Extension GA
az storage blob service-properties delete-policy

Manage storage blob delete-policy service properties.

Core GA
az storage blob service-properties delete-policy show

Show the storage blob delete-policy.

Core GA
az storage blob service-properties delete-policy update

Update the storage blob delete-policy.

Core GA
az storage blob service-properties show

Gets the properties of a storage account's Blob service, including Azure Storage Analytics.

Core GA
az storage blob service-properties update

Update storage blob service properties.

Core GA
az storage blob service-properties update (storage-blob-preview extension)

Update storage blob service properties.

Extension GA
az storage blob set-legal-hold

Set blob legal hold.

Core GA
az storage blob set-tier

Set the block or page tiers on the blob.

Core GA
az storage blob set-tier (storage-blob-preview extension)

Set the block or page tiers on the blob.

Extension GA
az storage blob show

Get the details of a blob.

Core GA
az storage blob show (storage-blob-preview extension)

Get the details of a blob.

Extension GA
az storage blob snapshot

Creates a snapshot of the blob.

Core GA
az storage blob sync

Sync blobs recursively to a storage blob container.

Core Preview
az storage blob tag

Manage blob tags.

Extension Preview
az storage blob tag list

Get tags on a blob or specific blob version, or snapshot.

Extension Preview
az storage blob tag set

Set tags on a blob or specific blob version, but not snapshot.

Extension Preview
az storage blob undelete

Restore soft deleted blob or snapshot.

Core GA
az storage blob update

Sets system properties on the blob.

Core GA
az storage blob upload

Upload a file to a storage blob.

Core GA
az storage blob upload-batch

Upload files from a local directory to a blob container.

Core GA
az storage blob url

Create the url to access a blob.

Core GA

az storage blob delete

Mark a blob or snapshot for deletion.

The blob is marked for later deletion during garbage collection. In order to delete a blob, all of its snapshots must also be deleted. Both can be removed at the same time.

az storage blob delete [--account-key]
                       [--account-name]
                       [--acquire-policy-token]
                       [--auth-mode {key, login}]
                       [--blob-endpoint]
                       [--blob-url]
                       [--change-reference]
                       [--connection-string]
                       [--container-name]
                       [--delete-snapshots {include, only}]
                       [--if-match]
                       [--if-modified-since]
                       [--if-none-match]
                       [--if-unmodified-since]
                       [--lease-id]
                       [--name]
                       [--sas-token]
                       [--snapshot]
                       [--tags-condition]
                       [--timeout]

Examples

Delete a blob.

az storage blob delete -c mycontainer -n MyBlob

Delete a blob using login credentials.

az storage blob delete -c mycontainer -n MyBlob --account-name mystorageaccount --auth-mode login

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 or service endpoint. 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
--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy 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
--blob-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

Property Value
Parameter group: Storage Account Arguments
--blob-url

The full endpoint URL to the Blob, including SAS token and snapshot if used. This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode.

--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--container-name -c

The container name.

--delete-snapshots

Required if the blob has associated snapshots. Values include: "only": Deletes only the blobs snapshots. "include": Deletes the blob along with all snapshots.

Property Value
Accepted values: include, only
--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

Property Value
Parameter group: Precondition Arguments
--if-modified-since

Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

Property Value
Parameter group: Precondition Arguments
--if-unmodified-since

Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--lease-id

Required if the blob has an active lease.

--name -n

The blob name.

--sas-token

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

Property Value
Parameter group: Storage Account Arguments
--snapshot

The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to delete.

--tags-condition

Specify a SQL where clause on blob tags to operate only on blobs with a matching value.

Property Value
Parameter group: Precondition Arguments
--timeout

Request timeout in seconds. Applies to each call to the service.

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 blob delete (storage-blob-preview extension)

Mark a blob or snapshot for deletion.

The blob is marked for later deletion during garbage collection. In order to delete a blob, all of its snapshots must also be deleted. Both can be removed at the same time.

az storage blob delete [--account-key]
                       [--account-name]
                       [--acquire-policy-token]
                       [--auth-mode {key, login}]
                       [--blob-endpoint]
                       [--blob-url]
                       [--change-reference]
                       [--connection-string]
                       [--container-name]
                       [--delete-snapshots {include, only}]
                       [--if-match]
                       [--if-modified-since]
                       [--if-none-match]
                       [--if-unmodified-since]
                       [--lease-id]
                       [--name]
                       [--sas-token]
                       [--snapshot]
                       [--tags-condition]
                       [--timeout]
                       [--version-id]

Examples

Delete a blob.

az storage blob delete -c mycontainer -n MyBlob

Delete a blob using login credentials.

az storage blob delete -c mycontainer -n MyBlob --account-name mystorageaccount --auth-mode login

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
--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy 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
--blob-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

Property Value
Parameter group: Storage Account Arguments
--blob-url

The full endpoint URL to the Blob, including SAS token and snapshot if used. This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode.

--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--container-name -c

The container name.

--delete-snapshots

Required if the blob has associated snapshots. "only": Deletes only the blobs snapshots. "include": Deletes the blob along with all snapshots.

Property Value
Accepted values: include, only
--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

Property Value
Parameter group: Precondition Arguments
--if-modified-since

Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

Property Value
Parameter group: Precondition Arguments
--if-unmodified-since

Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--lease-id

Required if the blob has an active lease.

--name -n

The blob name.

--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
--snapshot

The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.

--tags-condition

Specify a SQL where clause on blob tags to operate only on blobs with a matching value.

Property Value
Parameter group: Precondition Arguments
--timeout

Request timeout in seconds. Applies to each call to the service.

--version-id

An optional blob version ID. This parameter is only for versioning enabled account.

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 blob delete-batch

Delete blobs from a blob container recursively.

az storage blob delete-batch --source
                             [--account-key]
                             [--account-name]
                             [--acquire-policy-token]
                             [--auth-mode {key, login}]
                             [--blob-endpoint]
                             [--change-reference]
                             [--connection-string]
                             [--delete-snapshots {include, only}]
                             [--dryrun]
                             [--if-match]
                             [--if-modified-since]
                             [--if-none-match]
                             [--if-unmodified-since]
                             [--lease-id]
                             [--pattern]
                             [--sas-token]
                             [--timeout]

Examples

Delete all blobs ending with ".py" in a container that have not been modified for 10 days.

date=`date -d "10 days ago" '+%Y-%m-%dT%H:%MZ'`
az storage blob delete-batch -s mycontainer --account-name mystorageaccount --pattern "*.py" --if-unmodified-since $date --auth-mode login

Delete all the blobs in a directory named "dir" in a container named "mycontainer".

az storage blob delete-batch -s mycontainer --pattern "dir/*"

Delete the blobs with the format 'cli-2018-xx-xx.txt' or 'cli-2019-xx-xx.txt' in a container.

az storage blob delete-batch -s mycontainer --pattern "cli-201[89]-??-??.txt"

Delete all blobs with the format 'cli-201x-xx-xx.txt' except cli-2018-xx-xx.txt' and 'cli-2019-xx-xx.txt' in a container.

az storage blob delete-batch -s mycontainer --pattern "cli-201[!89]-??-??.txt"

Required Parameters

--source -s

The blob container from where the files will be deleted.

The source can be the container URL or the container name. When the source is the container URL, the storage account name will be parsed from the URL.

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 or service endpoint. 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
--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy 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
--blob-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

Property Value
Parameter group: Storage Account Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--delete-snapshots

Required if the blob has associated snapshots.

Property Value
Accepted values: include, only
--dryrun

Show the summary of the operations to be taken instead of actually deleting the file(s).

If this is specified, it will ignore all the Precondition Arguments that include --if-modified-since and --if-unmodified-since. So the file(s) will be deleted with the command without --dryrun may be different from the result list with --dryrun flag on.

Property Value
Default value: False
--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

Property Value
Parameter group: Precondition Arguments
--if-modified-since

Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--if-none-match

An ETag value, or the wildcard character (*).

Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character (*) to perform the operation only if the resource does not exist, and fail the operation if it does exist.

Property Value
Parameter group: Precondition Arguments
--if-unmodified-since

Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--lease-id

The active lease id for the blob.

--pattern

The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'. For more information, please refer to https://docs.python.org/3/library/fnmatch.html.

When you use '*' in --pattern, it will match any character including the the directory separator '/'. You can also try "az storage remove" command with --include and --exclude with azure cli >= 2.0.70 to match multiple patterns.

--sas-token

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

Property Value
Parameter group: Storage Account Arguments
--timeout

Request timeout in seconds. Applies to each call to the service.

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 blob download

Download a blob to a file path.

az storage blob download [--account-key]
                         [--account-name]
                         [--acquire-policy-token]
                         [--auth-mode {key, login}]
                         [--blob-endpoint]
                         [--blob-url]
                         [--change-reference]
                         [--connection-string]
                         [--container-name]
                         [--end-range]
                         [--file]
                         [--if-match]
                         [--if-modified-since]
                         [--if-none-match]
                         [--if-unmodified-since]
                         [--lease-id]
                         [--max-connections]
                         [--name]
                         [--no-progress]
                         [--open-mode]
                         [--overwrite {false, true}]
                         [--sas-token]
                         [--snapshot]
                         [--start-range]
                         [--tags-condition]
                         [--timeout]
                         [--validate-content]
                         [--version-id]

Examples

Download a blob.

az storage blob download -f /path/to/file -c mycontainer -n MyBlob

Download a blob content to stdout(pipe support).

az storage blob download -c mycontainer -n myblob --account-name mystorageaccount --account-key myaccountkey

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 or service endpoint. 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
--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy 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
--blob-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

Property Value
Parameter group: Storage Account Arguments
--blob-url

The full endpoint URL to the Blob, including SAS token and snapshot if used. This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode.

--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--container-name -c

The container name.

--end-range

End of byte range to use for downloading a section of the blob. If end_range is given, start_range must be provided. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob.

--file -f

Path of file to write out to. If not specified, stdout will be used and max_connections will be set to 1.

--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

Property Value
Parameter group: Precondition Arguments
--if-modified-since

Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

Property Value
Parameter group: Precondition Arguments
--if-unmodified-since

Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

Property Value
Parameter group: Precondition Arguments
--lease-id

Required if the blob has an active lease.

--max-connections

The number of parallel connections with which to download.

Property Value
Default value: 2
--name -n

The blob name.

--no-progress

Include this flag to disable progress reporting for the command.

Property Value
Default value: False
--open-mode

Mode to use when opening the file. Note that specifying append only open_mode prevents parallel download. So, max_connections must be set to 1 if this open_mode is used.

Property Value
Default value: wb
--overwrite

Overwrite an existing file when specified. Default value is true.

Property Value
Default value: True
Accepted values: false, true
--sas-token

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

Property Value
Parameter group: Storage Account Arguments
--snapshot

The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.

--start-range

Start of byte range to use for downloading a section of the blob. If no end_range is given, all bytes after the start_range will be downloaded. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob.

--tags-condition

Specify a SQL where clause on blob tags to operate only on blobs with a matching value.

Property Value
Parameter group: Precondition Arguments
--timeout

Request timeout in seconds. Applies to each call to the service.

--validate-content

If true, calculates an MD5 hash for each chunk of the blob. The storage service checks the hash of the content that has arrived with the hash that was sent. This is primarily valuable for detecting bitflips on the wire if using http instead of https, as https (the default), will already validate. Note that this MD5 hash is not stored with the blob. Also note that if enabled, the memory-efficient algorithm will not be used because computing the MD5 hash requires buffering entire blocks, and doing so defeats the purpose of the memory-efficient algorithm.

Property Value
Default value: False
--version-id

An optional blob version ID. This parameter is only for versioning enabled account.

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 blob download-batch

Download blobs from a blob container recursively.

az storage blob download-batch --destination
                               --source
                               [--account-key]
                               [--account-name]
                               [--acquire-policy-token]
                               [--auth-mode {key, login}]
                               [--blob-endpoint]
                               [--change-reference]
                               [--connection-string]
                               [--dryrun]
                               [--max-connections]
                               [--no-progress]
                               [--overwrite {false, true}]
                               [--pattern]
                               [--sas-token]

Examples

Download all blobs that end with .py

az storage blob download-batch -d . --pattern "*.py" -s mycontainer --account-name mystorageaccount --account-key 00000000

Download all blobs in a directory named "dir" from container named "mycontainer".

az storage blob download-batch -d . -s mycontainer --pattern "dir/*"

Download all blobs with the format 'cli-2018-xx-xx.txt' or 'cli-2019-xx-xx.txt' in container to current path.

az storage blob download-batch -d . -s mycontainer --pattern "cli-201[89]-??-??.txt"

Download all blobs with the format 'cli-201x-xx-xx.txt' except cli-2018-xx-xx.txt' and 'cli-2019-xx-xx.txt' in container to current path.

az storage blob download-batch -d . -s mycontainer --pattern "cli-201[!89]-??-??.txt"

Required Parameters

--destination -d

The existing destination folder for this download operation.

--source -s

The blob container from where the files will be downloaded.

The source can be the container URL or the container name. When the source is the container URL, the storage account name will be parsed from the URL.

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 or service endpoint. 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
--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy 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
--blob-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

Property Value
Parameter group: Storage Account Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

Property Value
Parameter group: Storage Account Arguments
--dryrun

Show the summary of the operations to be taken instead of actually downloading the file(s).

Property Value
Default value: False
--max-connections

The number of parallel connections with which to download.

Property Value
Default value: 2
--no-progress

Include this flag to disable progress reporting for the command.

Property Value
Default value: False
--overwrite

Overwrite an existing file when specified. Default value is false.

Property Value
Default value: False
Accepted values: false, true
--pattern

The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'. For more information, please refer to https://docs.python.org/3/library/fnmatch.html.

When you use '*' in --pattern, it will match any character including the the directory separator '/'.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. 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 blob exists

Check for the existence of a blob in a container.

az storage blob exists [--account-key]
                       [--account-name]
                       [--acquire-policy-token]
                       [--auth-mode {key, login}]
                       [--blob-endpoint]
                       [--blob-url]
                       [--change-reference]
                       [--connection-string]
                       [--container-name]
                       [--name]
                       [--sas-token]
                       [--snapshot]
                       [--timeout]

Examples

Check for the existence of a blob in a container. (autogenerated)

az storage blob exists --account-key 00000000 --account-name MyAccount --container-name mycontainer --name MyBlob

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