az storage blob

Manage object storage for unstructured data (blobs).

Commands

az storage blob copy Manage blob copy operations.
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.
az storage blob copy start-batch Copy multiple blobs or files to a blob container.
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 Creates the url to access a 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]
[--connection-string]
[--delete-snapshots {include, only}]
[--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

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

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--delete-snapshots

Required if the blob has associated snapshots.

accepted values: include, only
--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

Alter 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

Alter 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
[--account-key]
[--account-name]
[--connection-string]
[--delete-snapshots {include, only}]
[--dryrun]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--pattern]
[--sas-token]
[--timeout]

Required Parameters

--source -s

The blob container from where the files will be deleted.

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.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--delete-snapshots
accepted values: include, only
--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

Alter 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

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

Returns an instance of Blob with properties and metadata.

az storage blob download --container-name
--file
--name
[--account-key]
[--account-name]
[--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]
[--start-range]
[--timeout]
[--validate-content]

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.

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

Alter 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

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

--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
[--account-key]
[--account-name]
[--connection-string]
[--dryrun]
[--max-connections]
[--no-progress]
[--pattern]
[--sas-token]

Required Parameters

--destination -d

The existing destination folder for this download operation.

--source -s

The blob container from where the files will be downloaded.

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.

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

Include this flag to disable progress reporting for the command.

--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
--name
[--account-key]
[--account-name]
[--connection-string]
[--sas-token]
[--snapshot]
[--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.

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

Use the returned signature with the sas_token parameter of any BlobService.

az storage blob generate-sas --container-name
--name
[--account-key]
[--account-name]
[--cache-control]
[--connection-string]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-type]
[--expiry]
[--https-only]
[--ip]
[--permissions]
[--policy-name]
[--sas-token]
[--start]

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.

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

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.

--https-only

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

--ip

Specifies the IP address or range of IP addresses from which to accept requests. Supports only IPv4 style addresses.

--permissions

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

--policy-name

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

--sas-token

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

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

az storage blob list

List blobs in a given container.

az storage blob list --container-name
[--account-key]
[--account-name]
[--connection-string]
[--delimiter]
[--include]
[--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.

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

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

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]
[--connection-string]
[--sas-token]
[--timeout]
[--type {block, page}]

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.

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

--type -t

The blob type.

accepted values: block, page
default value: block

az storage blob show

Get the details of a blob.

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

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

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

Alter 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

Alter 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 --container-name
--name
[--account-key]
[--account-name]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--metadata]
[--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.

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

Alter 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

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

Attempting to undelete a blob or snapshot that is not soft deleted will succeed without any changes.

az storage blob undelete --container-name
--name
[--account-key]
[--account-name]
[--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.

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

If one property is set for the content_settings, all properties will be overriden.

az storage blob update --container-name
--name
[--account-key]
[--account-name]
[--connection-string]
[--content-cache-control]
[--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]
[--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.

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

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

Alter 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

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

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]
[--connection-string]
[--content-cache-control]
[--content-disposition]
[--content-encoding]
[--content-language]
[--content-md5]
[--content-type]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-id]
[--max-connections]
[--maxsize-condition]
[--metadata]
[--no-progress]
[--sas-token]
[--tier {P10, P20, P30, P4, P40, P50, P6, P60}]
[--timeout]
[--type {append, block, page}]
[--validate-content]

Examples

Upload to a blob.

az storage blob upload -f /path/to/file -c MyContainer -n 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.

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

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

Alter 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

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

--no-progress

Include this flag to disable progress reporting for the command.

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

accepted values: P10, P20, P30, P4, P40, P50, P6, P60
--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.

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]
[--connection-string]
[--content-cache-control]
[--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]
[--pattern]
[--sas-token]
[--timeout]
[--type {append, block, page}]
[--validate-content]

Required Parameters

--destination -d

The blob container where the files will be uploaded.

--source -s

The directory where the files to be uploaded are located.

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.

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

--destination-path

The destination path that will be appended to the blob name.

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

Alter 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

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

--no-progress

Include this flag to disable progress reporting for the command.

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

--type -t

Defaults to 'page' for *.vhd files, or 'block' otherwise. The setting will override blob types for every file.

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.

az storage blob url

Creates the url to access a blob.

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

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.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--protocol

Protocol to use.

accepted values: http, https
default value: https
--sas-token

Shared access signature token created with generate_shared_access_signature.

--snapshot

An string value that uniquely identifies the snapshot. The value of this query parameter indicates the snapshot version.