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 access |
Manage the access control properties of a blob when Hierarchical Namespace is enabled. |
Extension | Deprecated |
az storage blob access set |
Set the access control properties of a blob. |
Extension | Deprecated |
az storage blob access show |
Show the access control properties of a blob. |
Extension | Deprecated |
az storage blob access update |
Update the access control properties of a blob. |
Extension | Deprecated |
az storage blob copy |
Manage blob copy operations. Use |
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 |
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 |
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 directory |
Manage blob directories in storage account container. |
Extension | Deprecated |
az storage blob directory access |
Manage the access control properties of a directory when Hierarchical Namespace is enabled. |
Extension | Preview and Deprecated |
az storage blob directory access set |
Set the access control properties of a directory. |
Extension | Preview and Deprecated |
az storage blob directory access show |
Show the access control properties of a directory. |
Extension | Preview and Deprecated |
az storage blob directory access update |
Update the access control properties of a directory. |
Extension | Preview and Deprecated |
az storage blob directory create |
Create a storage blob directory in a storage container. |
Extension | Deprecated |
az storage blob directory delete |
Delete a storage blob directory in a storage container. |
Extension | Deprecated |
az storage blob directory download |
Download blobs to a local file path. |
Extension | Deprecated |
az storage blob directory exists |
Check for the existence of a blob directory in a storage container. |
Extension | Deprecated |
az storage blob directory list |
List blobs and blob subdirectories in a storage directory. |
Extension | Deprecated |
az storage blob directory metadata |
Manage directory metadata. |
Extension | Deprecated |
az storage blob directory metadata show |
Show all user-defined metadata for the specified blob directory. |
Extension | Deprecated |
az storage blob directory metadata update |
Set user-defined metadata for the specified blob directory as one or more name-value pairs. |
Extension | Deprecated |
az storage blob directory move |
Move a storage directory to another storage blob directory in a storage container. |
Extension | Deprecated |
az storage blob directory show |
Show a storage blob directory properties in a storage container. |
Extension | Deprecated |
az storage blob directory upload |
Upload blobs or subdirectories to a storage blob directory. |
Extension | Deprecated |
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 move |
Move a blob in a storage container. |
Extension | Preview and Deprecated |
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]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--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
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
Required if the blob has associated snapshots. Values include: "only": Deletes only the blobs snapshots. "include": Deletes the blob along with all snapshots.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
The blob name.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to delete.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
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]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--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
Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
Required if the blob has associated snapshots. "only": Deletes only the blobs snapshots. "include": Deletes the blob along with all snapshots.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
The blob name.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
An optional blob version ID. This parameter is only for versioning enabled account.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob delete-batch
Delete blobs from a blob container recursively.
az storage blob delete-batch --source
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--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
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
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
Required if the blob has associated snapshots.
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.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
The active lease id for the blob.
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.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob download
Download a blob to a file path.
az storage blob download [--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--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
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
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.
Path of file to write out to. If not specified, stdout will be used and max_connections will be set to 1.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
The number of parallel connections with which to download.
The blob name.
Include this flag to disable progress reporting for the command.
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.
Overwrite an existing file when specified. Default value is true.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.
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.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
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.
An optional blob version ID. This parameter is only for versioning enabled account.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob download-batch
Download blobs from a blob container recursively.
az storage blob download-batch --destination
--source
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--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
The existing destination folder for this download operation.
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
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
Show the summary of the operations to be taken instead of actually downloading the file(s).
The number of parallel connections with which to download.
Include this flag to disable progress reporting for the command.
Overwrite an existing file when specified. Default value is false.
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 '/'.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob exists
Check for the existence of a blob in a container.
az storage blob exists [--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--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
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
The blob name.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The snapshot parameter is an opaque DateTime value that, when present, specifies the snapshot.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob filter
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
List blobs across all containers whose tags match a given search expression.
az storage blob filter --tag-filter
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--connection-string]
[--container-name]
[--sas-token]
Required Parameters
The expression to find blobs whose tags matches the specified condition. eg. ""yourtagname"='firsttag' and "yourtagname2"='secondtag'".
Optional Parameters
Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
Used when you want to list blobs under a specified container.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob generate-sas
Generate a shared access signature for the blob.
az storage blob generate-sas [--account-key]
[--account-name]
[--as-user]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--cache-control]
[--connection-string]
[--container-name]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-type]
[--encryption-scope]
[--expiry]
[--full-uri]
[--https-only]
[--ip]
[--name]
[--permissions]
[--policy-name]
[--snapshot]
[--start]
[--timeout]
Examples
Generate a sas token for a blob with read-only permissions.
end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
az storage blob generate-sas -c myycontainer -n MyBlob --permissions r --expiry $end --https-only
Generate a sas token for a blob with ip range specified.
end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
az storage blob generate-sas -c myycontainer -n MyBlob --ip "176.134.171.0-176.134.171.255" --permissions r --expiry $end --https-only
Generate a shared access signature for the blob. (autogenerated)
az storage blob generate-sas --account-key 00000000 --account-name MyStorageAccount --container-name mycontainer --expiry 2018-01-01T00:00:00Z --name MyBlob --permissions r
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
Indicates that this command return the SAS signed with the user delegation key. The expiry parameter and '--auth-mode login' are required if this argument is specified.
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.
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.
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
.
Response header value for Cache-Control when resource is accessed using this shared access signature.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
Response header value for Content-Disposition when resource is accessed using this shared access signature.
Response header value for Content-Encoding when resource is accessed using this shared access signature.
Response header value for Content-Language when resource is accessed using this shared access signature.
Response header value for Content-Type when resource is accessed using this shared access signature.
A predefined encryption scope used to encrypt the data on the service.
Specifies the UTC datetime (Y-m-d'T'H:M'Z') at which the SAS becomes invalid. Do not use if a stored access policy is referenced with --policy-name that specifies this value.
Indicates that this command return the full blob URI and the shared access signature token.
Only permit requests made with the HTTPS protocol. If omitted, requests from both the HTTP and HTTPS protocol are permitted.
Specifies the IP address or range of IP addresses from which to accept requests. Supports only IPv4 style addresses.
The blob name.
The permissions the SAS grants. Allowed values: (a)dd (c)reate (d)elete (e)xecute (i)set_immutability_policy (m)ove (r)ead (t)ag (w)rite (x)delete_previous_version (y)permanent_delete. Do not use if a stored access policy is referenced with --id that specifies this value. Can be combined.
The name of a stored access policy within the container's ACL.
An optional blob snapshot ID. Opaque DateTime value that, when present, specifies the blob snapshot to grant permission.
Specifies the UTC datetime (Y-m-d'T'H:M'Z') at which the SAS becomes valid. Do not use if a stored access policy is referenced with --policy-name that specifies this value. Defaults to the time of the request.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob generate-sas (storage-blob-preview extension)
Generate a shared access signature for the blob.
az storage blob generate-sas --container-name
--name
[--account-key]
[--account-name]
[--as-user]
[--auth-mode {key, login}]
[--blob-endpoint]
[--cache-control]
[--connection-string]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-type]
[--expiry]
[--full-uri]
[--https-only]
[--ip]
[--permissions]
[--policy-name]
[--snapshot]
[--start]
[--version-id]
Examples
Generate a sas token for a blob with read-only permissions.
end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
az storage blob generate-sas -c myycontainer -n MyBlob --permissions r --expiry $end --https-only
Generate a sas token for a blob with ip range specified.
end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
az storage blob generate-sas -c myycontainer -n MyBlob --ip "176.134.171.0-176.134.171.255" --permissions r --expiry $end --https-only
Generate a shared access signature for the blob. (autogenerated)
az storage blob generate-sas --account-key 00000000 --account-name MyStorageAccount --container-name mycontainer --expiry 2018-01-01T00:00:00Z --name MyBlob --permissions r
Required Parameters
The container name.
The blob name.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
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.
Indicates that this command return the SAS signed with the user delegation key. The expiry parameter and '--auth-mode login' are required if this argument is specified.
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.
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.
Response header value for Cache-Control when resource is accessedusing this shared access signature.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
Response header value for Content-Disposition when resource is accessedusing this shared access signature.
Response header value for Content-Encoding when resource is accessedusing this shared access signature.
Response header value for Content-Language when resource is accessedusing this shared access signature.
Response header value for Content-Type when resource is accessedusing this shared access signature.
Specifies the UTC datetime (Y-m-d'T'H:M'Z') at which the SAS becomes invalid. Do not use if a stored access policy is referenced with --id that specifies this value.
Indicate that this command return the full blob URI and the shared access signature token.
Only permit requests made with the HTTPS protocol. If omitted, requests from both the HTTP and HTTPS protocol are permitted.
Specify an IP address or a range of IP addresses from which to accept requests. If the IP address from which the request originates does not match the IP address or address range specified on the SAS token, the request is not authenticated. For example, specifying ip=168.1.5.65 or ip=168.1.5.60-168.1.5.70 on the SAS restricts the request to those IP addresses.
The permissions the SAS grants. Allowed values: (a)dd (c)reate (d)elete (x)delete_previous_version (e)xecute (m)ove (p)ermanent_delete (r)ead (s)et_immutability_policy (t)ag (w)rite. Do not use if a stored access policy is referenced with --policy-name that specifies this value. Can be combined.
The name of a stored access policy within the container's ACL.
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.
Specifies the UTC datetime (Y-m-d'T'H:M'Z') at which the SAS becomes valid. Do not use if a stored access policy is referenced with --id that specifies this value. Defaults to the time of the request.
An optional blob version ID. This parameter is only for versioning enabled account.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob list
List blobs in a given container.
az storage blob list --container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--connection-string]
[--delimiter]
[--include]
[--marker]
[--num-results]
[--prefix]
[--sas-token]
[--show-next-marker]
[--timeout]
Examples
List all storage blobs in a container whose names start with 'foo'; will match names such as 'foo', 'foobar', and 'foo/bar'
az storage blob list -c mycontainer --prefix foo
Required Parameters
The container name.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
When the request includes this parameter, the operation returns a BlobPrefix element in the result list that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string.
Specify one or more additional datasets to include in the response. Options include: (c)opy, (d)eleted, (m)etadata, (s)napshots, (v)ersions, (t)ags, (i)mmutabilitypolicy, (l)egalhold, (d)eletedwithversions. Can be combined.
A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. If specified, this generator will begin returning results from the point where the previous generator stopped.
Specify the maximum number to return. If the request does not specify num_results, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remaining of the results. Provide "*" to return all.
Filter the results to return only blobs whose name begins with the specified prefix.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Show nextMarker in result when specified.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob move
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
This command has been deprecated and will be removed in future release. Use 'az storage fs file move' instead. For more information go to https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/storage/docs/ADLS%20Gen2.md
Move a blob in a storage container.
az storage blob move --container-name
--destination-blob
--source-blob
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--lease-id]
[--sas-token]
[--source-if-match]
[--source-if-modified-since]
[--source-if-none-match]
[--source-if-unmodified-since]
[--source-lease-id]
[--timeout]
Examples
Move a blob in a storage container.
az storage blob move -c MyContainer -d DestinationBlobPath -s SourceBlobPath --account-name MyStorageAccount
Required Parameters
The container name.
The destination blob name. It should be an absolute path under the container. e.g.'topdir1/dirbar'.
The source blob name. It should be an absolute path under the container. e.g.'topdir1/dirsubfoo'.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
Optional. A lease ID for the new_path. The new_path must have an active lease and the lease ID must match.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Optional. An ETag value. Specify this header to perform the rename operation only if the source's ETag matches the value specified.
Optional. A date and time value. Specify this header to perform the rename operation only if the source has been modified since the specified date and time.
Optional. An ETag value or the special wildcard ("*") value. Specify this header to perform the rename operation only if the source's ETag does not match the value specified.
Optional. A date and time value. Specify this header to perform the rename operation only if the source has not been modified since the specified date and time.
Optional. A lease ID for the source_path. The source_path must have an active lease and the lease ID must match.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob query
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Enable users to select/project on blob or blob snapshot data by providing simple query expressions.
az storage blob query --query-expression
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--in-column-separator]
[--in-escape-char]
[--in-has-header]
[--in-line-separator]
[--in-quote-char]
[--in-record-separator]
[--input-format {csv, json}]
[--lease-id]
[--name]
[--out-column-separator]
[--out-escape-char]
[--out-has-header]
[--out-line-separator]
[--out-quote-char]
[--out-record-separator]
[--output-format {csv, json}]
[--result-file]
[--sas-token]
[--tags-condition]
[--timeout]
Examples
Enable users to select/project on blob by providing simple query expressions.
az storage blob query -c mycontainer -n myblob --query-expression "SELECT _2 from BlobStorage"
Enable users to select/project on blob by providing simple query expressions and save in target file.
az storage blob query -c mycontainer -n myblob --query-expression "SELECT _2 from BlobStorage" --result-file result.csv
Required Parameters
The query expression in SQL. The maximum size of the query expression is 256KiB. For more information about the expression syntax, please see https://docs.microsoft.com/azure/storage/blobs/query-acceleration-sql-reference.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
The string used to separate columns.
The string used as an escape character. Default to empty.
Whether the blob data includes headers in the first line. The default value is False, meaning that the data will be returned inclusive of the first line. If set to True, the data will be returned exclusive of the first line.
The string used to separate records.
The string used to quote a specific field.
The string used to separate records.
Serialization type of the data currently stored in the blob. The default is to treat the blob data as CSV data formatted in the default dialect.The blob data will be reformatted according to that profile when blob format is specified. If you choose json
, please specify Output Json Text Configuration Arguments
accordingly; If you choose csv
, please specify Output Delimited Text Configuration Arguments
.
Required if the blob has an active lease.
The blob name.
The string used to separate columns.
The string used as an escape character. Default to empty.
Whether the blob data includes headers in the first line. The default value is False, meaning that the data will be returned inclusive of the first line. If set to True, the data will be returned exclusive of the first line.
The string used to separate records.
The string used to quote a specific field.
The string used to separate records.
Output serialization type for the data stream. By default the data will be returned as it is represented in the blob. By providing an output format, the blob data will be reformatted according to that profile. If you choose json
, please specify Output Json Text Configuration Arguments
accordingly; If you choose csv
, please specify Output Delimited Text Configuration Arguments
.
Specify the file path to save result.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob restore
Restore blobs in the specified blob ranges.
az storage blob restore --account-name
--time-to-restore
[--blob-range]
[--no-wait]
[--resource-group]
Examples
Restore blobs in two specified blob ranges. For examples, (container1/blob1, container2/blob2) and (container2/blob3..container2/blob4).
az storage blob restore --account-name mystorageaccount -g MyResourceGroup -t 2020-02-27T03:59:59Z -r container1/blob1 container2/blob2 -r container2/blob3 container2/blob4
Restore blobs in the specified blob ranges from account start to account end.
az storage blob restore --account-name mystorageaccount -g MyResourceGroup -t 2020-02-27T03:59:59Z -r "" ""
Restore blobs in the specified blob range.
time=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
az storage blob restore --account-name mystorageaccount -g MyResourceGroup -t $time -r container0/blob1 container0/blob2
Restore blobs in the specified blob range without wait and query blob restore status with 'az storage account show'.
time=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
az storage blob restore --account-name mystorageaccount -g MyResourceGroup -t $time -r container0/blob1 container0/blob2 --no-wait
Required Parameters
The storage account name.
Restore blob to the specified time, which should be UTC datetime in (Y-m-d'T'H:M:S'Z').
Optional Parameters
Blob ranges to restore. You need to two values to specify start_range and end_range for each blob range, e.g. -r blob1 blob2. Note: Empty means account start as start range value, and means account end for end range.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob rewrite
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Create a new Block Blob where the content of the blob is read from a given URL.
The content of an existing blob is overwritten with the new blob.
az storage blob rewrite --container-name
--name
--source-uri
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--connection-string]
[--encryption-scope]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--sas-token]
[--tags-condition]
[--tier {Archive, Cold, Cool, Hot, P10, P15, P20, P30, P4, P40, P50, P6, P60, P70, P80}]
[--timeout]
Examples
Update encryption scope for existing blob.
az storage blob rewrite --source-uri https://srcaccount.blob.core.windows.net/mycontainer/myblob?<sastoken> --encryption-scope newscope -c mycontainer -n myblob --account-name mystorageaccount --account-key 0000-0000
Required Parameters
The container name.
The blob name.
A URL of up to 2 KB in length that specifies a file or blob. The value should be URL-encoded as it would appear in a request URI. If the source is in another account, the source must either be public or must be authenticated via a shared access signature. If the source is public, no authentication is required.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
A standard blob tier value to set the blob to. For this version of the library, this is only applicable to block blobs on standard storage accounts.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob set-legal-hold
Set blob legal hold.
az storage blob set-legal-hold --container-name
--legal-hold {false, true}
--name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--connection-string]
[--sas-token]
[--timeout]
Examples
Configure blob legal hold.
az storage blob set-legal-hold --legal-hold -c mycontainer -n myblob --account-name mystorageaccount --account-key 0000-0000
Clear blob legal hold.
az storage blob set-legal-hold --legal-hold false -c mycontainer -n myblob --account-name mystorageaccount --account-key 0000-0000
Required Parameters
The container name.
Specified if a legal hold should be set on the blob.
The blob name.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob set-tier
Set the block or page tiers on the blob.
For block blob this command only supports block blob on standard storage accounts. For page blob, this command only supports for page blobs on premium accounts.
az storage blob set-tier --tier
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--name]
[--rehydrate-priority {High, Standard}]
[--sas-token]
[--timeout]
[--type {block, page}]
Examples
Set the block or page tiers on the blob. (autogenerated)
az storage blob set-tier --account-key 00000000 --account-name MyAccount --container-name mycontainer --name MyBlob --tier P10
Required Parameters
The tier value to set the blob to.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
The blob name.
Indicate the priority with which to rehydrate an archived blob. The priority can be set on a blob only once, default value is Standard.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually.
The blob type.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob set-tier (storage-blob-preview extension)
Set the block or page tiers on the blob.
For block blob this command only supports block blob on standard storage accounts. For page blob, this command only supports for page blobs on premium accounts.
az storage blob set-tier --tier
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--name]
[--rehydrate-priority {High, Standard}]
[--sas-token]
[--tags-condition]
[--timeout]
[--type {block, page}]
[--version-id]
Examples
Set the block or page tiers on the blob. (autogenerated)
az storage blob set-tier --account-key 00000000 --account-name MyAccount --container-name mycontainer --name MyBlob --tier P10
Required Parameters
The tier value to set the blob to.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
The blob name.
Indicate the priority with which to rehydrate an archived blob.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually.
The blob type.
An optional blob version ID. This parameter is only for versioning enabled account.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob show
Get the details of a blob.
az storage blob show [--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--name]
[--sas-token]
[--snapshot]
[--tags-condition]
[--timeout]
Examples
Show all properties of a blob.
az storage blob show -c mycontainer -n MyBlob
Get the details of a blob (autogenerated)
az storage blob show --account-name mystorageccount --account-key 00000000 --container-name mycontainer --name MyBlob
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
The blob name.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob show (storage-blob-preview extension)
Get the details of a blob.
az storage blob show [--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--name]
[--sas-token]
[--snapshot]
[--tags-condition]
[--timeout]
[--version-id]
Examples
Show all properties of a blob.
az storage blob show -c mycontainer -n MyBlob
Get the details of a blob (autogenerated)
az storage blob show --account-name mystorageccount --account-key 00000000 --container-name mycontainer --name MyBlob
Optional Parameters
Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
The blob name.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
An optional blob version ID. This parameter is only for versioning enabled account.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob snapshot
Creates a snapshot of the blob.
A snapshot is a read-only version of a blob that's taken at a point in time. It can be read, copied, or deleted, but not modified. Snapshots provide a way to back up a blob as it appears at a moment in time. A snapshot of a blob has the same name as the base blob from which the snapshot is taken, with a DateTime value appended to indicate the time at which the snapshot was taken.
az storage blob snapshot [--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--metadata]
[--name]
[--sas-token]
[--tags-condition]
[--timeout]
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
Metadata in space-separated key=value pairs. This overwrites any existing metadata.
The blob name.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob sync
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Sync blobs recursively to a storage blob container.
az storage blob sync --container
--source
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--delete-destination {false, prompt, true}]
[--destination]
[--exclude-path]
[--exclude-pattern]
[--include-pattern]
[--sas-token]
[<EXTRA_OPTIONS>]
Examples
Sync a single blob to a container.
az storage blob sync -c mycontainer -s "path/to/file" -d NewBlob
Sync a directory to a container.
az storage blob sync -c mycontainer --account-name mystorageccount --account-key 00000000 -s "path/to/directory"
Sync a directory to a container with azcopy options pass-through (in this case capping the upload bandwith to 20 MBit/s).
az storage blob sync -c mycontainer --account-name mystorageccount --account-key 00000000 -s "path/to/directory" -- --cap-mbps=20
Required Parameters
The sync destination container.
The source file path to sync from.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
Defines whether to delete extra files from the destination that are not present at the source. Could be set to true, false, or prompt. If set to prompt, the user will be asked a question before scheduling files and blobs for deletion.
The destination path that will be prepended to the blob name.
Exclude these paths. This option does not support wildcard characters (*). Checks relative path prefix. For example: myFolder;myFolder/subDirName/file.pdf.
Exclude these files where the name matches the pattern list. For example: .jpg;.pdf;exactName. This option supports wildcard characters (*).
Include only these files where the name matches the pattern list. For example: .jpg;.pdf;exactName. This option supports wildcard characters (*).
A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Other options which will be passed through to azcopy as it is. Please put all the extra options after a --
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob undelete
Restore soft deleted blob or snapshot.
Operation will only be successful if used within the specified number of days set in the delete retention policy. Attempting to undelete a blob or snapshot that is not soft deleted will succeed without any changes.
az storage blob undelete [--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--name]
[--sas-token]
[--timeout]
Examples
Undelete a blob.
az storage blob undelete -c mycontainer -n MyBlob
Undelete a blob using login credentials.
az storage blob undelete -c mycontainer -n MyBlob --account-name mystorageaccount --auth-mode login
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
The blob name.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob update
Sets system properties on the blob.
If one property is set for the content_settings, all properties will be overridden.
az storage blob update --container-name
--name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--clear-content-settings {false, true}]
[--connection-string]
[--content-cache]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-md5]
[--content-type]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--sas-token]
[--tags-condition]
[--timeout]
Required Parameters
The container name.
The blob name.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
If this flag is set, then if any one or more of the following properties (--content-cache-control, --content-disposition, --content-encoding, --content-language, --content-md5, --content-type) is set, then all of these properties are set together. If a value is not provided for a given property when at least one of the properties listed below is set, then that property will be cleared.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The cache control string.
Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.
The content encoding type.
The content language.
The content's MD5 hash.
The content MIME type.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
Request timeout in seconds. Applies to each call to the service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob upload
Upload a file to a storage blob.
Create a new blob from a file path, or updates the content of an existing blob with automatic chunking and progress notifications.
az storage blob upload [--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--blob-url]
[--connection-string]
[--container-name]
[--content-cache]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-md5]
[--content-type]
[--data]
[--encryption-scope]
[--file]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--length]
[--max-connections]
[--maxsize-condition]
[--metadata]
[--name]
[--no-progress]
[--overwrite {false, true}]
[--sas-token]
[--socket-timeout]
[--tags]
[--tags-condition]
[--tier]
[--timeout]
[--type {append, block, page}]
[--validate-content]
Examples
Upload to a blob.
az storage blob upload -f /path/to/file -c mycontainer -n MyBlob
Upload to a blob with blob sas url.
az storage blob upload -f /path/to/file --blob-url https://mystorageaccount.blob.core.windows.net/mycontainer/myblob?sv=2019-02-02&st=2020-12-22T07%3A07%3A29Z&se=2020-12-23T07%3A07%3A29Z&sr=b&sp=racw&sig=redacted
Upload a file to a storage blob. (autogenerated)
az storage blob upload --account-name mystorageaccount --account-key 0000-0000 --container-name mycontainer --file /path/to/file --name myblob
Upload a string to a blob.
az storage blob upload --data "teststring" -c mycontainer -n myblob --account-name mystorageaccount --account-key 0000-0000
Upload to a through pipe.
echo $data | az storage blob upload --data @- -c mycontainer -n myblob --account-name mystorageaccount --account-key 0000-0000
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
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
.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The container name.
The cache control string.
Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.
The content encoding type.
The content language.
The content's MD5 hash.
The content MIME type.
The blob data to upload.
A predefined encryption scope used to encrypt the data on the service.
Path of the file to upload as the blob content.
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
Required if the blob has an active lease.
Number of bytes to read from the stream. This is optional, but should be supplied for optimal performance. Cooperate with --data.
Maximum number of parallel connections to use when the blob size exceeds 64MB.
The max length in bytes permitted for an append blob.
Metadata in space-separated key=value pairs. This overwrites any existing metadata.
The blob name.
Include this flag to disable progress reporting for the command.
Whether the blob to be uploaded should overwrite the current data. If True, blob upload operation will overwrite the existing data. If set to False, the operation will fail with ResourceExistsError. The exception to the above is with Append blob types: if set to False and the data already exists, an error will not be raised and the data will be appended to the existing blob. If set overwrite=True, then the existing append blob will be deleted, and a new one created. Defaults to False.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
The socket timeout(secs), used by the service to regulate data flow.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
The tier value to set the blob to. For page blob, the tier correlates to the size of the blob and number of allowed IOPS. Possible values are P10, P15, P20, P30, P4, P40, P50, P6, P60, P70, P80 and this is only applicable to page blobs on premium storage accounts; For block blob, possible values are Archive, Cold, Cool, and Hot. This is only applicable to block blobs on standard storage accounts.
Request timeout in seconds. Applies to each call to the service.
Default to 'page' for *.vhd files, or 'block' otherwise.
Specify that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob upload-batch
Upload files from a local directory to a blob container.
az storage blob upload-batch --destination
--source
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--connection-string]
[--content-cache]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-md5]
[--content-type]
[--destination-path]
[--dryrun]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--max-connections]
[--maxsize-condition]
[--metadata]
[--no-progress]
[--overwrite {false, true}]
[--pattern]
[--sas-token]
[--socket-timeout]
[--tags]
[--tags-condition]
[--tier]
[--timeout]
[--type {append, block, page}]
[--validate-content]
Examples
Upload all files that end with .py unless blob exists and has been modified since given date.
az storage blob upload-batch -d mycontainer --account-name mystorageaccount --account-key 00000000 -s <path-to-directory> --pattern "*.py" --if-unmodified-since 2018-08-27T20:51Z
Upload all files from local path directory to a container named "mycontainer".
az storage blob upload-batch -d mycontainer -s <path-to-directory>
Upload all files with the format 'cli-2018-xx-xx.txt' or 'cli-2019-xx-xx.txt' in local path directory.
az storage blob upload-batch -d mycontainer -s <path-to-directory> --pattern "cli-201[89]-??-??.txt"
Upload all files 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 upload-batch -d mycontainer -s <path-to-directory> --pattern "cli-201[!89]-??-??.txt"
Required Parameters
The blob container where the files will be uploaded.
The destination can be the container URL or the container name. When the destination is the container URL, the storage account name will be parsed from the URL.
The directory where the files to be uploaded are located.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
The cache control string.
Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.
The content encoding type.
The content language.
The content's MD5 hash.
The content MIME type.
The destination path that will be prepended to the blob name.
Show the summary of the operations to be taken instead of actually uploading the file(s).
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.
Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').
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.
Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').
The active lease id for the blob.
Maximum number of parallel connections to use when the blob size exceeds 64MB.
The max length in bytes permitted for an append blob.
Metadata in space-separated key=value pairs. This overwrites any existing metadata.
Include this flag to disable progress reporting for the command.
Whether the blob to be uploaded should overwrite the current data. If True, blob upload operation will overwrite the existing data. If set to False, the operation will fail with ResourceExistsError. The exception to the above is with Append blob types: if set to False and the data already exists, an error will not be raised and the data will be appended to the existing blob. If set overwrite=True, then the existing append blob will be deleted, and a new one created. Defaults to False.
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 '/'.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
Argument 'socket_timeout' has been deprecated and will be removed in a future release.
The socket timeout(secs), used by the service to regulate data flow.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Specify a SQL where clause on blob tags to operate only on blobs with a matching value.
The tier value to set the blob to. For page blob, the tier correlates to the size of the blob and number of allowed IOPS. Possible values are P10, P15, P20, P30, P4, P40, P50, P6, P60, P70, P80 and this is only applicable to page blobs on premium storage accounts; For block blob, possible values are Archive, Cold, Cool, and Hot. This is only applicable to block blobs on standard storage accounts.
Request timeout in seconds. Applies to each call to the service.
Defaults to 'page' for *.vhd files, or 'block' otherwise. The setting will override blob types for every file.
Specifies that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az storage blob url
Create the url to access a blob.
az storage blob url --container-name
--name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-endpoint]
[--connection-string]
[--protocol {http, https}]
[--sas-token]
[--snapshot]
Examples
Create the url to access a blob (autogenerated)
az storage blob url --connection-string $connectionString --container-name container1 --name blob1
Create the url to access a blob (autogenerated)
az storage blob url --account-name storageacct --account-key 00000000 --container-name container1 --name blob1
Required Parameters
The container name.
The blob name.
Optional Parameters
Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.
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.
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.
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.
Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
Protocol to use.
A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.
An string value that uniquely identifies the snapshot. The value of this query parameter indicates the snapshot version.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.