az storage blob

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

az storage blob copy

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

az storage blob copy start

List blobs in a given container.

az storage blob delete

Mark a blob or snapshot for deletion.

az storage blob download

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

az storage blob exists

Check for the existence of a blob in a container.

az storage blob filter

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

az storage blob generate-sas

Generate a shared access signature for the blob.

az storage blob lease

Manage storage blob leases.

az storage blob lease acquire

Request a new lease.

az storage blob lease break

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

az storage blob lease change

Change the lease ID of an active lease.

az storage blob lease release

Release the lease.

az storage blob lease renew

Renew the lease.

az storage blob list

List blobs in a given container.

az storage blob metadata

Manage blob metadata.

az storage blob metadata show

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

az storage blob metadata update

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

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 snapshot of the blob.

az storage blob tag

Manage blob tags.

az storage blob tag list

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

az storage blob tag set

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

az storage blob undelete

Restores soft-deleted blobs or snapshots.

az storage blob upload

Upload a file to a storage blob.

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 --container-name
                       --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]
                       [--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

Required Parameters

--container-name -c

The container name.

--name -n

The blob 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. Values include: - "only": Deletes only the blobs snapshots. - "include": Deletes the blob along with all snapshots. :keyword str version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to delete. .. versionadded:: 12.4.0 This keyword argument was introduced in API version '2019-12-12'. :keyword lease: Required if the blob has an active lease. If specified, delete_blob only succeeds if the blob's lease is active and matches this ID. Value can be a BlobLeaseClient object or the lease ID as a 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 modified 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.

--tags-condition

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

--timeout

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

--version-id

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

az storage blob download

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

az storage blob download --container-name
                         --file
                         --name
                         [--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]
                         [--no-progress]
                         [--open-mode]
                         [--sas-token]
                         [--snapshot]
                         [--socket-timeout]
                         [--start-range]
                         [--tags-condition]
                         [--timeout]
                         [--validate-content]
                         [--version-id]

Required Parameters

--container-name -c

The container name.

--file -f

Path of file to write out to.

--name -n

The blob 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.

--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 modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--lease-id

Required if the blob has an active lease.

--max-connections

The number of parallel connections with which to download.

default value: 2
--no-progress

Include this flag to disable progress reporting for the command.

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

--socket-timeout

The socket timeout(secs), used by the service to regulate data flow.

--start-range

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

--tags-condition

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

--timeout

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

--validate-content

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

--version-id

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

az storage blob exists

Check for the existence of a blob in a container.

az storage blob exists --container-name
                       --name
                       [--account-key]
                       [--account-name]
                       [--auth-mode {key, login}]
                       [--connection-string]
                       [--sas-token]
                       [--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

Required Parameters

--container-name -c

The container name.

--name -n

The blob 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 filter

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

Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container.

az storage blob filter --tag-filter
                       [--account-key]
                       [--account-name]
                       [--auth-mode {key, login}]
                       [--connection-string]
                       [--sas-token]

Required Parameters

--tag-filter

The expression to find blobs whose tags matches the specified condition. eg. ""yourtagname"='firsttag' and "yourtagname2"='secondtag'" To specify a container, eg. "@container='containerName' and "Name"='C'".

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.

az storage blob generate-sas

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}]
                             [--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

--container-name -c

The container name.

--name -n

The blob 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.

--as-user

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.

--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 accessedusing 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 accessedusing this shared access signature.

--content-encoding

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

--content-language

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

--content-type

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

--expiry

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.

--full-uri

Indicate that this command return the full blob URI and the shared access signature token.

--https-only

Only permit requests made with the HTTPS protocol. If omitted, requests from both the HTTP and HTTPS protocol are permitted.

--ip

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.

--permissions

The permissions the SAS grants. Allowed values: (a)dd (c)reate (d)elete (x)delete_previous_version (r)ead (t)ag (w)rite. Do not use if a stored access policy is referenced with --policy-name that specifies this value. Can be combined.

--policy-name

The name of a stored access policy within the container's ACL.

--snapshot

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

--start

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.

--version-id

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

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]
                     [--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

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

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. Can be combined.

--marker

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.

--num-results

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.

default value: 5000
--prefix

Filter the results to return only blobs whose name begins 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.

--show-next-marker

Show nextMarker in result when specified.

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

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 --container-name
                         --name
                         --tier
                         [--account-key]
                         [--account-name]
                         [--auth-mode {key, login}]
                         [--connection-string]
                         [--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

--container-name -c

The container name.

--name -n

The blob 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
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--rehydrate-priority -r

Indicate the priority with which to rehydrate an archived blob.

accepted values: High, Standard
--sas-token

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

--tags-condition

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

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

--type -t

The blob type.

accepted values: block, page
default value: block
--version-id

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

az storage blob show

Get the details of a blob.

az storage blob show --container-name
                     --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]
                     [--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

Required Parameters

--container-name -c

The container name.

--name -n

The blob 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 modified 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.

--tags-condition

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

--timeout

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

--version-id

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

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 --container-name
                         --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]
                         [--tags-condition]
                         [--timeout]

Required Parameters

--container-name -c

The container name.

--name -n

The blob 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 modified 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.

--tags-condition

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

--timeout

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

az storage blob undelete

Restores soft-deleted blobs or snapshots.

Operation will only be successful if used within the specified number of days set in the delete retention policy. :keyword int timeout: The timeout parameter is expressed in seconds. :rtype: None .. admonition:: Example: .. literalinclude:: ../samples/blob_samples_common.py :start-after: [START undelete_blob] :end-before: [END undelete_blob] :language: python :dedent: 8 :caption: Undeleting a blob.

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

Required Parameters

--container-name -c

The container name.

--name -n

The blob 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 upload

Upload a file to a storage blob.

Creates 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 --container-name
                       --file
                       --name
                       [--account-key]
                       [--account-name]
                       [--auth-mode {key, login}]
                       [--connection-string]
                       [--content-cache-control]
                       [--content-disposition]
                       [--content-encoding]
                       [--content-language]
                       [--content-md5]
                       [--content-type]
                       [--encryption-scope]
                       [--if-match]
                       [--if-modified-since]
                       [--if-none-match]
                       [--if-unmodified-since]
                       [--lease-id]
                       [--max-connections]
                       [--maxsize-condition]
                       [--metadata]
                       [--no-progress]
                       [--overwrite {false, true}]
                       [--sas-token]
                       [--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 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

Required Parameters

--container-name -c

The container name.

--file -f

Path of the file to upload as the blob content.

--name -n

The blob 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-cache-control

The cache control string.

--content-disposition

Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.

--content-encoding

The content encoding type.

--content-language

The content language.

--content-md5

The content's MD5 hash.

--content-type

The content MIME type.

--encryption-scope

A predefined encryption scope used to encrypt the data on the service.

--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 modified 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.

--no-progress

Include this flag to disable progress reporting for the command.

--overwrite

Whether the blob to be uploaded should overwrite the current data. If True, upload_blob 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.

accepted values: false, true
--sas-token

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

--tags

Space-separated tags: key[=value] [key[=value] ...]. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space ( ), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_).

--tags-condition

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

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

--type -t

Defaults to 'page' for *.vhd files, or 'block' otherwise.

accepted values: append, block, page
--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.