Storage containers - az storage container

Manage blob storage containers.

Commands

az storage container create Creates a container in a storage account.
az storage container delete Marks the specified container for deletion.
az storage container exists Indicates whether the container exists.
az storage container generate-sas Generates a shared access signature for the container.
az storage container lease Manage blob storage container leases.
az storage container lease acquire Requests a new lease.
az storage container lease break Break the lease, if the container has an active lease.
az storage container lease change Change the lease ID of an active lease.
az storage container lease release Release the lease.
az storage container lease renew Renews the lease.
az storage container list List containers in a storage account.
az storage container metadata Manage container metadata.
az storage container metadata show Returns all user-defined metadata for the specified container.
az storage container metadata update Sets one or more user-defined name-value pairs for the specified container.
az storage container policy Manage container stored access policies.
az storage container policy create Create a stored access policy on the containing object.
az storage container policy delete Delete a stored access policy on a containing object.
az storage container policy list List stored access policies on a containing object.
az storage container policy show Show a stored access policy on a containing object.
az storage container policy update Set a stored access policy on a containing object.
az storage container set-permission Sets the permissions for the specified container or stored access policies that may be used with Shared Access Signatures.
az storage container show Returns all user-defined metadata and system properties for the specified container.
az storage container show-permission Gets the permissions for the specified container.

az storage container create

Creates a container in a storage account.

az storage container create --name
[--account-key]
[--account-name]
[--connection-string]
[--fail-on-exist]
[--metadata]
[--public-access {blob, container, off}]
[--sas-token]
[--timeout]

Examples

Create a storage container in a storage account.

az storage container create -n MyStorageContainer

Create a storage container in a storage account and return an error if the container already exists.

az storage container create -n MyStorageContainer --fail-on-exist

Required Parameters

--name -n

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--fail-on-exist

Throw an exception if the container already exists.

--metadata

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

--public-access

Specifies whether data in the container may be accessed publically. By default, container data is private ("off") to the account owner. Use "blob" to allow public read access for blobs. Use "container" to allow public read and list access to the entire container.

accepted values: blob, container, off
--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 container delete

The container and any blobs contained within it are later deleted during garbage collection.

az storage container delete --name
[--account-key]
[--account-name]
[--connection-string]
[--fail-not-exist]
[--if-modified-since]
[--if-unmodified-since]
[--lease-id]
[--sas-token]
[--timeout]

Required Parameters

--name -n

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--fail-not-exist

Throw an exception if the container does not exist.

--if-modified-since

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

--if-unmodified-since

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

--lease-id

If specified, delete_container only succeeds if the container's lease is active and matches this ID. Required if the container 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 container exists

Indicates whether the container exists.

az storage container exists --name
[--account-key]
[--account-name]
[--connection-string]
[--sas-token]
[--timeout]

Required Parameters

--name -n

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--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 container generate-sas

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

az storage container generate-sas --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

--name -n

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--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: (d)elete (l)ist (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 container list

List containers in a storage account.

az storage container list [--account-key]
[--account-name]
[--connection-string]
[--include-metadata]
[--num-results]
[--prefix]
[--sas-token]
[--timeout]

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--include-metadata

Specifies that container metadata be returned in the response.

--num-results

Specifies the maximum number of containers to return. A single list request may return up to 1000 contianers and potentially a continuation token which should be followed to get additional resutls.

--prefix

Filters the results to return only containers 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 container set-permission

The permissions indicate whether blobs in a container may be accessed publicly.

az storage container set-permission --name
[--account-key]
[--account-name]
[--connection-string]
[--if-modified-since]
[--if-unmodified-since]
[--lease-id]
[--public-access {blob, container, off}]
[--sas-token]
[--timeout]

Required Parameters

--name -n

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-modified-since

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

--if-unmodified-since

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

--lease-id

If specified, set_container_acl only succeeds if the container's lease is active and matches this ID.

--public-access

Specifies whether data in the container may be accessed publically. By default, container data is private ("off") to the account owner. Use "blob" to allow public read access for blobs. Use "container" to allow public read and list access to the entire container.

accepted values: blob, container, off
--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 container show

The data returned does not include the container's list of blobs.

az storage container show --name
[--account-key]
[--account-name]
[--connection-string]
[--lease-id]
[--sas-token]
[--timeout]

Required Parameters

--name -n

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--lease-id

If specified, get_container_properties only succeeds if the container's lease is active and matches this ID.

--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 container show-permission

The permissions indicate whether container data may be accessed publicly.

az storage container show-permission --name
[--account-key]
[--account-name]
[--connection-string]
[--lease-id]
[--sas-token]
[--timeout]

Required Parameters

--name -n

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. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--lease-id

If specified, get_container_acl only succeeds if the container's lease is active and matches this ID.

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