az storage blob

Manage blobs in Azure Blob Storage.

Commands

Name Description Type Status
az storage blob copy

Manage asynchronous blob copy operations.

Core Preview
az storage blob copy start

Start an asynchronous copy of a source URL into a blob.

Core Preview
az storage blob delete

Delete a blob.

Core Preview
az storage blob download

Download a blob to a local file.

Core Preview
az storage blob list

List blobs in a container.

Core Preview
az storage blob show

Show the properties of a blob.

Core Preview
az storage blob upload

Upload a local file as a block blob.

Core Preview
az storage blob upload-from-url

Create a block blob from the content of a source URL.

Core Preview

az storage blob delete

Preview

Delete a blob.

Delete a blob. If the blob has snapshots, pass --delete-snapshots include to delete the blob with its snapshots, or --delete-snapshots only to delete only the snapshots.

az storage blob delete [--account-key]
                       [--account-name]
                       [--client-request-id]
                       [--container-name]
                       [--delete-snapshots {include, only}]
                       [--delete-type {Permanent}]
                       [--if-match]
                       [--if-modified-since]
                       [--if-none-match]
                       [--if-unmodified-since]
                       [--lease-id]
                       [--name]
                       [--sas-token]
                       [--snapshot]
                       [--tags-condition]
                       [--timeout]
                       [--url]
                       [--version-id]

Examples

Delete a blob

az storage blob delete --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --name myblob.txt

Delete a blob and its snapshots

az storage blob delete --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --name myblob.txt --delete-snapshots include

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.

--account-name

Storage account name. Used with the container and blob name when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--container-name

The container name.

--delete-snapshots

Required if the blob has snapshots. 'include' deletes the blob and its snapshots; 'only' deletes just the snapshots.

Property Value
Accepted values: include, only
--delete-type

'Permanent' permanently deletes a soft-deleted snapshot or version, if permanent delete is enabled on the account.

Property Value
Accepted values: Permanent
--if-match

Delete only if the blob's ETag matches this value.

--if-modified-since

Delete only if the blob has been modified since the specified date-time.

--if-none-match

Delete only if the blob's ETag does not match this value.

--if-unmodified-since

Delete only if the blob has not been modified since the specified date-time.

--lease-id

If specified, the operation only succeeds if the blob's lease is active and matches this ID.

--name

The blob name.

--sas-token

A shared access signature. Alternative to --account-key.

--snapshot

The snapshot of the blob to delete.

--tags-condition

A SQL where clause on blob tags; delete only if it matches.

--timeout

The timeout parameter is expressed in seconds.

--url

The blob URL. Alternative to --account-name, --container-name and --name.

--version-id

The version ID of the blob to delete.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage blob download

Preview

Download a blob to a local file.

Download the content of a blob to a local file. Use --snapshot or --version-id to download a specific snapshot or version.

az storage blob download --file
                         [--account-key]
                         [--account-name]
                         [--client-request-id]
                         [--container-name]
                         [--encryption-algorithm {AES256}]
                         [--encryption-key]
                         [--encryption-key-sha256]
                         [--if-match]
                         [--if-modified-since]
                         [--if-none-match]
                         [--if-unmodified-since]
                         [--lease-id]
                         [--name]
                         [--sas-token]
                         [--snapshot]
                         [--tags-condition]
                         [--timeout]
                         [--url]
                         [--version-id]

Examples

Download a blob

az storage blob download --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --name myblob.txt --file ./downloaded.txt

Required Parameters

--file

Path of the local file to create. An existing file is not overwritten.

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.

--account-name

Storage account name. Used with the container and blob name when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--container-name

The container name.

--encryption-algorithm

The algorithm used to produce the encryption key hash. Must be provided if the encryption key is provided.

Property Value
Accepted values: AES256
--encryption-key

The customer-provided key the blob was encrypted with.

--encryption-key-sha256

The SHA-256 hash of the provided encryption key. Must be provided if the encryption key is provided.

--if-match

Download only if the blob's ETag matches this value.

--if-modified-since

Download only if the blob has been modified since the specified date-time.

--if-none-match

Download only if the blob's ETag does not match this value.

--if-unmodified-since

Download only if the blob has not been modified since the specified date-time.

--lease-id

If specified, the operation only succeeds if the blob's lease is active and matches this ID.

--name

The blob name.

--sas-token

A shared access signature. Alternative to --account-key.

--snapshot

The snapshot of the blob to download.

--tags-condition

A SQL where clause on blob tags; download only if it matches.

--timeout

The timeout parameter is expressed in seconds.

--url

The blob URL. Alternative to --account-name, --container-name and --name.

--version-id

The version ID of the blob to download.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage blob list

Preview

List blobs in a container.

List the blobs in a container, following continuation markers until all pages are returned. Use --prefix to filter by name.

az storage blob list [--account-key]
                     [--account-name]
                     [--client-request-id]
                     [--container-name]
                     [--marker]
                     [--maxresults]
                     [--prefix]
                     [--sas-token]
                     [--start-from]
                     [--timeout]
                     [--url]

Examples

List blobs in a container

az storage blob list --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer

List blobs with a name prefix

az storage blob list --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --prefix logs/

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.

--account-name

Storage account name. Used with the container (and blob) name when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--container-name

The container name.

--marker

An opaque string value that identifies the portion of the result set to return with this operation.

--maxresults

Specifies the maximum number of resources to return.

--prefix

Filters the results to return only resources whose name begins with the specified prefix.

--sas-token

A shared access signature. Alternative to --account-key.

--start-from

Specifies the relative path to list paths from.

--timeout

The timeout parameter is expressed in seconds.

--url

The container URL. Alternative to --account-name and --container-name.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage blob show

Preview

Show the properties of a blob.

Get the system properties and user-defined metadata of a blob without downloading its content. Use --snapshot or --version-id to read a specific snapshot or version.

az storage blob show [--account-key]
                     [--account-name]
                     [--client-request-id]
                     [--container-name]
                     [--encryption-algorithm {AES256}]
                     [--encryption-key]
                     [--encryption-key-sha256]
                     [--if-match]
                     [--if-modified-since]
                     [--if-none-match]
                     [--if-tags]
                     [--if-unmodified-since]
                     [--lease-id]
                     [--name]
                     [--sas-token]
                     [--snapshot]
                     [--timeout]
                     [--url]
                     [--version-id]

Examples

Show a blob

az storage blob show --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --name myblob.txt

Show a blob by URL with a SAS token

az storage blob show --url https://mystorageaccount.blob.core.windows.net/mycontainer/myblob.txt --sas-token $SAS_TOKEN

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.

--account-name

Storage account name. Used with the container (and blob) name when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--container-name

The container name.

--encryption-algorithm

The algorithm used to produce the encryption key hash. Must be provided if the encryption key is provided.

Property Value
Accepted values: AES256
--encryption-key

Specifies the encryption key to use to encrypt the data provided in the request.

--encryption-key-sha256

The SHA-256 hash of the provided encryption key. Must be provided if the encryption key is provided.

--if-match

Specify this value to operate only on a blob with a matching Etag value.

--if-modified-since

Specify this value to operate only on a blob if it has been modified since the specified date-time.

--if-none-match

Specify this value to operate only on a blob with a non-matching Etag value.

--if-tags

Specifies a SQL-like where clause on blob tags to operate only on a blob with matching tags.

--if-unmodified-since

Specify this value to operate only on a blob if it has not been modified since the specified date-time.

--lease-id

If specified, the operation only succeeds if the resource's lease is active and matches this ID.

--name

The blob name.

--sas-token

A shared access signature. Alternative to --account-key.

--snapshot

Specifies the snapshot of the blob.

--timeout

The timeout parameter is expressed in seconds.

--url

The blob URL. Alternative to --account-name, --container-name and --name.

--version-id

Specifies the version ID of the blob.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage blob upload

Preview

Upload a local file as a block blob.

Upload a local file to a container as a block blob. An existing blob with the same name is not overwritten. Set content headers, metadata, tags, and the access tier on the new blob.

az storage blob upload --file
                       [--account-key]
                       [--account-name]
                       [--client-request-id]
                       [--container-name]
                       [--content-cache-control]
                       [--content-disposition]
                       [--content-encoding]
                       [--content-language]
                       [--content-type]
                       [--encryption-scope]
                       [--metadata]
                       [--name]
                       [--sas-token]
                       [--tags]
                       [--tier]
                       [--timeout]
                       [--url]

Examples

Upload a file

az storage blob upload --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --name myblob.txt --file ./myfile.txt

Upload a file with a content type and metadata

az storage blob upload --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --name report.json --file ./report.json --content-type application/json --metadata team=storage env=test

Required Parameters

--file

Path of the local file to upload. An existing blob is not overwritten.

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.

--account-name

Storage account name. Used with the container and blob name when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--container-name

The container name.

--content-cache-control

The blob's cache control.

--content-disposition

The blob's content disposition.

--content-encoding

The blob's content encoding.

--content-language

The blob's content language.

--content-type

The blob's content type.

--encryption-scope

The encryption scope used to encrypt the blob.

--metadata

Metadata in space-separated key=value pairs.

--name

The blob name.

--sas-token

A shared access signature. Alternative to --account-key.

--tags

Tags in space-separated key=value pairs.

--tier

The tier to be set on the blob.

--timeout

The timeout parameter is expressed in seconds.

--url

The blob URL. Alternative to --account-name, --container-name and --name.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage blob upload-from-url

Preview

Create a block blob from the content of a source URL.

Create a block blob whose content is read synchronously from a source URL. The source must be publicly readable or carry its own SAS token. Use blob copy start for an asynchronous, server-side copy instead.

az storage blob upload-from-url --source-uri
                                [--account-key]
                                [--account-name]
                                [--client-request-id]
                                [--container-name]
                                [--content-cache-control]
                                [--content-disposition]
                                [--content-encoding]
                                [--content-language]
                                [--content-type]
                                [--copy-source-blob-properties]
                                [--encryption-scope]
                                [--metadata]
                                [--name]
                                [--sas-token]
                                [--tags]
                                [--tier]
                                [--timeout]
                                [--url]

Examples

Create a blob from a public URL

az storage blob upload-from-url --account-name mystorageaccount --account-key $ACCOUNT_KEY --container-name mycontainer --name readme.md --source-uri https://raw.githubusercontent.com/Azure/azure-rest-api-specs/refs/heads/main/specification/storage/data-plane/BlobStorage/readme.md

Required Parameters

--source-uri

The source blob URL. It must be public, in the destination account, or carry a SAS. An existing destination blob is not overwritten.

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.

--account-name

Storage account name. Used with the container and blob name when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--container-name

The container name.

--content-cache-control

The blob's cache control.

--content-disposition

The blob's content disposition.

--content-encoding

The blob's content encoding.

--content-language

The blob's content language.

--content-type

The blob's content type.

--copy-source-blob-properties

Whether the source blob's properties are copied. Defaults to true.

--encryption-scope

The encryption scope used to encrypt the blob.

--metadata

Metadata in space-separated key=value pairs.

--name

The blob name.

--sas-token

A shared access signature for the destination. Alternative to --account-key; a source SAS goes in --source-uri.

--tags

Tags in space-separated key=value pairs.

--tier

The tier to be set on the blob.

--timeout

The timeout parameter is expressed in seconds.

--url

The blob URL. Alternative to --account-name, --container-name and --name.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.