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
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.
Storage account key.
Storage account name. Used with the container and blob name when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The container name.
Required if the blob has snapshots. 'include' deletes the blob and its snapshots; 'only' deletes just the snapshots.
| Property | Value |
|---|---|
| Accepted values: | include, only |
'Permanent' permanently deletes a soft-deleted snapshot or version, if permanent delete is enabled on the account.
| Property | Value |
|---|---|
| Accepted values: | Permanent |
Delete only if the blob's ETag matches this value.
Delete only if the blob has been modified since the specified date-time.
Delete only if the blob's ETag does not match this value.
Delete only if the blob has not been modified since the specified date-time.
If specified, the operation only succeeds if the blob's lease is active and matches this ID.
The blob name.
A shared access signature. Alternative to --account-key.
The snapshot of the blob to delete.
A SQL where clause on blob tags; delete only if it matches.
The timeout parameter is expressed in seconds.
The blob URL. Alternative to --account-name, --container-name and --name.
The version ID of the blob to delete.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage blob download
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
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.
Storage account key.
Storage account name. Used with the container and blob name when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The container name.
The algorithm used to produce the encryption key hash. Must be provided if the encryption key is provided.
| Property | Value |
|---|---|
| Accepted values: | AES256 |
The customer-provided key the blob was encrypted with.
The SHA-256 hash of the provided encryption key. Must be provided if the encryption key is provided.
Download only if the blob's ETag matches this value.
Download only if the blob has been modified since the specified date-time.
Download only if the blob's ETag does not match this value.
Download only if the blob has not been modified since the specified date-time.
If specified, the operation only succeeds if the blob's lease is active and matches this ID.
The blob name.
A shared access signature. Alternative to --account-key.
The snapshot of the blob to download.
A SQL where clause on blob tags; download only if it matches.
The timeout parameter is expressed in seconds.
The blob URL. Alternative to --account-name, --container-name and --name.
The version ID of the blob to download.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage blob list
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.
Storage account key.
Storage account name. Used with the container (and blob) name when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The container name.
An opaque string value that identifies the portion of the result set to return with this operation.
Specifies the maximum number of resources to return.
Filters the results to return only resources whose name begins with the specified prefix.
A shared access signature. Alternative to --account-key.
Specifies the relative path to list paths from.
The timeout parameter is expressed in seconds.
The container URL. Alternative to --account-name and --container-name.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage blob show
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.
Storage account key.
Storage account name. Used with the container (and blob) name when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The container name.
The algorithm used to produce the encryption key hash. Must be provided if the encryption key is provided.
| Property | Value |
|---|---|
| Accepted values: | AES256 |
Specifies the encryption key to use to encrypt the data provided in the request.
The SHA-256 hash of the provided encryption key. Must be provided if the encryption key is provided.
Specify this value to operate only on a blob with a matching Etag value.
Specify this value to operate only on a blob if it has been modified since the specified date-time.
Specify this value to operate only on a blob with a non-matching Etag value.
Specifies a SQL-like where clause on blob tags to operate only on a blob with matching tags.
Specify this value to operate only on a blob if it has not been modified since the specified date-time.
If specified, the operation only succeeds if the resource's lease is active and matches this ID.
The blob name.
A shared access signature. Alternative to --account-key.
Specifies the snapshot of the blob.
The timeout parameter is expressed in seconds.
The blob URL. Alternative to --account-name, --container-name and --name.
Specifies the version ID of the blob.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage blob upload
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
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.
Storage account key.
Storage account name. Used with the container and blob name when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The container name.
The blob's cache control.
The blob's content disposition.
The blob's content encoding.
The blob's content language.
The blob's content type.
The encryption scope used to encrypt the blob.
Metadata in space-separated key=value pairs.
The blob name.
A shared access signature. Alternative to --account-key.
Tags in space-separated key=value pairs.
The tier to be set on the blob.
The timeout parameter is expressed in seconds.
The blob URL. Alternative to --account-name, --container-name and --name.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage blob upload-from-url
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
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.
Storage account key.
Storage account name. Used with the container and blob name when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The container name.
The blob's cache control.
The blob's content disposition.
The blob's content encoding.
The blob's content language.
The blob's content type.
Whether the source blob's properties are copied. Defaults to true.
The encryption scope used to encrypt the blob.
Metadata in space-separated key=value pairs.
The blob name.
A shared access signature for the destination. Alternative to --account-key; a source SAS goes in --source-uri.
Tags in space-separated key=value pairs.
The tier to be set on the blob.
The timeout parameter is expressed in seconds.
The blob URL. Alternative to --account-name, --container-name and --name.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.