az storage blob

Manage object storage for unstructured data (blobs).

Commands

az storage blob copy Manage blob copy operations. Use `az storage blob show` to check the status of the blobs.
az storage blob copy cancel Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata.
az storage blob copy start Copies a blob asynchronously. Use `az storage blob show` to check the status of the blobs.
az storage blob copy start-batch Copy multiple blobs or files to a blob container. Use `az storage blob show` to check the status of the blobs.
az storage blob delete Mark a blob or snapshot for deletion.
az storage blob delete-batch Delete blobs from a blob container recursively.
az storage blob download Downloads a blob to a file path, with automatic chunking and progress notifications.
az storage blob download-batch Download blobs from a blob container recursively.
az storage blob exists Check for the existence of a blob in a container.
az storage blob generate-sas Generates a shared access signature for the blob.
az storage blob incremental-copy Manage blob incremental copy operations.
az storage blob incremental-copy cancel Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata.
az storage blob incremental-copy start Copies an incremental copy of a blob asynchronously.
az storage blob lease Manage storage blob leases.
az storage blob lease acquire Requests a new lease.
az storage blob lease break Breaks the lease, if the blob has an active lease.
az storage blob lease change Changes the lease ID of an active lease.
az storage blob lease release Releases the lease.
az storage blob lease renew Renews the lease.
az storage blob list List blobs in a given container.
az storage blob metadata Manage blob metadata.
az storage blob metadata show Returns all user-defined metadata for the specified blob or snapshot.
az storage blob metadata update Sets user-defined metadata for the specified blob as one or more name-value pairs.
az storage blob service-properties Manage storage blob service properties.
az storage blob service-properties delete-policy Manage storage blob delete-policy service properties.
az storage blob service-properties delete-policy show Show the storage blob delete-policy.
az storage blob service-properties delete-policy update Update the storage blob delete-policy.
az storage blob service-properties show Gets the properties of a storage account's Blob service, including Azure Storage Analytics.
az storage blob set-tier Set the block or page tiers on the blob.
az storage blob show Get the details of a blob.
az storage blob snapshot Creates a read-only snapshot of a blob.
az storage blob undelete The undelete Blob operation restores the contents and metadata of soft deleted blob or snapshot.
az storage blob update Sets system properties on the blob.
az storage blob upload Upload a file to a storage blob.
az storage blob upload-batch Upload files from a local directory to a blob container.
az storage blob url Create the url to access a blob.

az storage blob delete

Mark a blob or snapshot for deletion.

az storage blob delete --blob-name
--container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--delete-snapshots]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--sas-token]
[--snapshot]
[--timeout]

Examples

Delete a blob.

az storage blob delete -c MyContainer -n MyBlob

Required Parameters

--blob-name

Name of existing blob.

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--delete-snapshots

Required if the blob has associated snapshots.

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id

Required if the blob has an active lease.

--sas-token

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

--snapshot

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

--timeout

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

az storage blob delete-batch

Delete blobs from a blob container recursively.

az storage blob delete-batch --source
--source-container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--delete-snapshots]
[--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

Required Parameters

--source
--source-container-name

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--delete-snapshots
--dryrun

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

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id
--pattern

The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'.

--sas-token

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

--timeout

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

az storage blob download

Downloads a blob to a file path, with automatic chunking and progress notifications.

az storage blob download --blob-name
--container-name
--file-path
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--end-range]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--max-connections]
[--open-mode]
[--sas-token]
[--snapshot]
[--start-range]
[--timeout]
[--validate-content]

Required Parameters

--blob-name

Name of existing blob.

--container-name -c

The container name.

--file-path

Path of file to write out to.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--end-range

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

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id

Required if the blob has an active lease.

--max-connections

If set to 2 or greater, an initial get will be done for the first self.MAX_SINGLE_GET_SIZE bytes of the blob. If this is the entire blob, the method returns at this point. If it is not, it will download the remaining data parallel using the number of threads equal to max_connections. Each chunk will be of size self.MAX_CHUNK_GET_SIZE. If set to 1, a single large get request will be done. This is not generally recommended but available if very few threads should be used, network requests are very expensive, or a non-seekable stream prevents parallel download. This may also be useful if many blobs are expected to be empty as an extra request is required for empty blobs if max_connections is greater than 1.

default value: 2
--open-mode

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

default value: wb
--sas-token

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

--snapshot

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

--start-range

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

--timeout

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

--validate-content

If set to true, validates an MD5 hash for each retrieved portion of the blob. 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 the service will only return transactional MD5s for chunks 4MB or less so the first get request will be of size self.MAX_CHUNK_GET_SIZE instead of self.MAX_SINGLE_GET_SIZE. If self.MAX_CHUNK_GET_SIZE was set to greater than 4MB an error will be thrown. As computing the MD5 takes processing time and more requests will need to be done due to the reduced chunk size there may be some increase in latency.

az storage blob download-batch

Download blobs from a blob container recursively.

az storage blob download-batch --destination
--source
--source-container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--dryrun]
[--max-connections]
[--pattern]
[--sas-token]

Examples

Download all blobs that end with .py

az storage blob download-batch -d . --pattern *.py -s MyContainer --account-name MyStorageAccount

Required Parameters

--destination
--source
--source-container-name

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--dryrun

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

--max-connections
default value: 2
--pattern

The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'.

--sas-token

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

az storage blob exists

Check for the existence of a blob in a container.

az storage blob exists --container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-name]
[--connection-string]
[--sas-token]
[--snapshot]
[--timeout]

Required Parameters

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--blob-name

Name of a blob. If None, the container will be checked for existence.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--sas-token

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

--snapshot

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

--timeout

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

az storage blob generate-sas

Generates a shared access signature for the blob.

az storage blob generate-sas --blob-name
--container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--cache-control]
[--connection-string]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-type]
[--expiry]
[--id]
[--ip]
[--permission]
[--protocol]
[--sas-token]
[--start]

Examples

Generate a sas token for a blob with read-only permissions.

end=`date -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
                        az storage blob generate-sas --account-name MyStorageAccount -c MyContainer -n MyBlob --permissions r --expiry $end --https-only

Required Parameters

--blob-name

Name of blob.

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--cache-control

Response header value for Cache-Control when resource is accessed using this shared access signature.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content-disposition

Response header value for Content-Disposition when resource is accessed using this shared access signature.

--content-encoding

Response header value for Content-Encoding when resource is accessed using this shared access signature.

--content-language

Response header value for Content-Language when resource is accessed using this shared access signature.

--content-type

Response header value for Content-Type when resource is accessed using this shared access signature.

--expiry

The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

--id

A unique value up to 64 characters in length that correlates to a stored access policy. To create a stored access policy, use set_container_acl().

--ip

Specifies 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 sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS restricts the request to those IP addresses.

--permission

The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Permissions must be ordered read, write, delete, list. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy.

--protocol

Specifies the protocol permitted for a request made. The default value is https,http. See Protocol for possible values.

--sas-token

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

--start

The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

az storage blob list

List blobs in a given container.

az storage blob list --container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--delimiter]
[--include]
[--marker]
[--num-results]
[--prefix]
[--sas-token]
[--timeout]

Required Parameters

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--delimiter

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.

--include

Specifies additional datasets to include: (c)opy-info, (m)etadata, (s)napshots, (d)eleted-soft. Can be combined.

--marker

An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object if num_results was specified and that generator has finished enumerating results. If specified, this generator will begin returning results from the point where the previous generator stopped.

--num-results

Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the request does not specify num_results or specifies a value greater than 5,000, the server will return up to 5,000 items. Setting num_results to a value less than or equal to zero results in error response code 400 (Bad Request).

--prefix

Filters the results to return only blobs whose names begin with the specified prefix.

--sas-token

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

--timeout

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

az storage blob set-tier

Set the block or page tiers on the blob.

az storage blob set-tier --blob-name
--container-name
--tier
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-type]
[--connection-string]
[--sas-token]
[--timeout]

Required Parameters

--blob-name
--container-name -c

The container name.

--tier

The tier value to set the blob to.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--blob-type
default value: block
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--sas-token

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

--timeout

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.

az storage blob show

Get the details of a blob.

az storage blob show --blob-name
--container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--sas-token]
[--snapshot]
[--timeout]

Examples

Show all properties of a blob.

az storage blob show -c MyContainer -n MyBlob

Required Parameters

--blob-name

Name of existing blob.

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id

Required if the blob has an active lease.

--sas-token

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

--snapshot

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

--timeout

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

az storage blob snapshot

Creates a read-only snapshot of a blob.

az storage blob snapshot --blob-name
--container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--metadata]
[--sas-token]
[--timeout]

Required Parameters

--blob-name

Name of existing blob.

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id

Required if the blob has an active lease.

--metadata

Metadata in space-separated key=value pairs. This overwrites any existing metadata.

--sas-token

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

--timeout

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

az storage blob undelete

The undelete Blob operation restores the contents and metadata of soft deleted blob or snapshot.

az storage blob undelete --blob-name
--container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--sas-token]
[--timeout]

Required Parameters

--blob-name

Name of existing blob.

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--sas-token

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

--timeout

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

az storage blob update

Sets system properties on the blob.

az storage blob update --blob-name
--container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--content-settings]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--sas-token]
[--timeout]

Required Parameters

--blob-name

Name of existing blob.

--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content-settings

ContentSettings object used to set blob properties.

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id

Required if the blob has an active lease.

--sas-token

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

--timeout

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

az storage blob upload

Upload a file to a storage blob.

az storage blob upload --blob-name
--container-name
--file-path
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--blob-type]
[--connection-string]
[--content-settings]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--max-connections]
[--maxsize-condition]
[--metadata]
[--sas-token]
[--tier]
[--timeout]
[--validate-content]

Examples

Upload to a blob.

az storage blob upload -f /path/to/file -c MyContainer -n MyBlob

Required Parameters

--blob-name

Name of blob to create or update.

--container-name -c

The container name.

--file-path

Path of the file to upload as the blob content.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--blob-type
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content-settings

ContentSettings object used to set blob properties.

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id

Required if the blob has an active lease.

--max-connections

Maximum number of parallel connections to use when the blob size exceeds 64MB.

default value: 2
--maxsize-condition

The max length in bytes permitted for an append blob.

--metadata

Metadata in space-separated key=value pairs. This overwrites any existing metadata.

--sas-token

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

--tier

A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts.

--timeout

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

--validate-content

Specifies that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.

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-type]
[--connection-string]
[--content-settings]
[--destination-container-name]
[--destination-path]
[--dryrun]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--max-connections]
[--maxsize-condition]
[--metadata]
[--pattern]
[--sas-token]
[--source-files]
[--timeout]
[--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 -s directory_path --pattern *.py --if-unmodified-since 2018-08-27T20:51Z

Required Parameters

--destination
--source

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--blob-type
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content-settings
--destination-container-name
--destination-path
--dryrun

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

--if-match

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

--if-modified-since

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

--if-none-match

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

--if-unmodified-since

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

--lease-id

Required if the blob has an active lease.

--max-connections
default value: 2
--maxsize-condition

The max length in bytes permitted for an append blob.

--metadata

Metadata in space-separated key=value pairs. This overwrites any existing metadata.

--pattern

The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'.

--sas-token

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

--source-files
--timeout

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

--validate-content

Specifies that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.

az storage blob url

Create the url to access a blob.

az storage blob url --blob-name
--container-name
[--account-key]
[--account-name]
[--auth-mode {key, login}]
[--connection-string]
[--protocol]
[--sas-token]
[--snapshot]

Required Parameters

--blob-name
--container-name -c

The container name.

Optional Parameters

--account-key

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

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--protocol
--sas-token

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

--snapshot