az storage

Manage Azure Cloud Storage resources.

Commands

az storage account Manage storage accounts.
az storage account check-name Checks that the storage account name is valid and is not already in use.
az storage account create Create a storage account.
az storage account delete Delete a storage account.
az storage account generate-sas Generates a shared access signature for the account.
az storage account keys Manage storage account keys.
az storage account keys list List the access keys or Kerberos keys (if active directory enabled) for a storage account.
az storage account keys renew Regenerate one of the access keys or Kerberos keys (if active directory enabled) for a storage account.
az storage account list List storage accounts.
az storage account management-policy Manage storage account management policies.
az storage account management-policy create Creates the data policy rules associated with the specified storage account.
az storage account management-policy delete Deletes the managementpolicy associated with the specified storage account.
az storage account management-policy show Gets the managementpolicy associated with the specified storage account.
az storage account management-policy update Updates the data policy rules associated with the specified storage account.
az storage account network-rule Manage network rules.
az storage account network-rule add Add a network rule.
az storage account network-rule list List network rules.
az storage account network-rule remove Remove a network rule.
az storage account revoke-delegation-keys Revoke all user delegation keys for a storage account.
az storage account show Show storage account properties.
az storage account show-connection-string Get the connection string for a storage account.
az storage account show-usage Show the current count and limit of the storage accounts under the subscription.
az storage account update Update the properties of a storage account.
az storage blob Manage object storage for unstructured data (blobs).
az storage blob copy Manage blob copy operations. Use `az storage blob show` to check the status of the blobs.
az storage blob copy cancel Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata.
az storage blob copy start Copies a blob asynchronously. Use `az storage blob show` to check the status of the blobs.
az storage blob copy start-batch Copy multiple blobs or files to a blob container. Use `az storage blob show` to check the status of the blobs.
az storage blob delete Mark a blob or snapshot for deletion.
az storage blob delete-batch Delete blobs from a blob container recursively.
az storage blob download Downloads a blob to a file path, with automatic chunking and progress notifications.
az storage blob download-batch Download blobs from a blob container recursively.
az storage blob exists Check for the existence of a blob in a container.
az storage blob generate-sas Generates a shared access signature for the blob.
az storage blob incremental-copy Manage blob incremental copy operations.
az storage blob incremental-copy cancel Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata.
az storage blob incremental-copy start Copies an incremental copy of a blob asynchronously.
az storage blob lease Manage storage blob leases.
az storage blob lease acquire Requests a new lease.
az storage blob lease break Breaks the lease, if the blob has an active lease.
az storage blob lease change Changes the lease ID of an active lease.
az storage blob lease release Releases the lease.
az storage blob lease renew Renews the lease.
az storage blob list List blobs in a given container.
az storage blob metadata Manage blob metadata.
az storage blob metadata show Returns all user-defined metadata for the specified blob or snapshot.
az storage blob metadata update Sets user-defined metadata for the specified blob as one or more name-value pairs.
az storage blob service-properties Manage storage blob service properties.
az storage blob service-properties delete-policy Manage storage blob delete-policy service properties.
az storage blob service-properties delete-policy show Show the storage blob delete-policy.
az storage blob service-properties delete-policy update Update the storage blob delete-policy.
az storage blob service-properties show Gets the properties of a storage account's Blob service, including Azure Storage Analytics.
az storage blob service-properties update Update storage blob service properties.
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 sync Sync blobs recursively to a storage blob container.
az storage blob undelete The undelete Blob operation restores the contents and metadata of soft deleted blob or snapshot.
az storage blob update Sets system properties on the blob.
az storage blob upload Upload a file to a storage blob.
az storage blob upload-batch Upload files from a local directory to a blob container.
az storage blob url Create the url to access a blob.
az storage container Manage blob storage containers.
az storage container create Create a container in a storage account.
az storage container delete Marks the specified container for deletion.
az storage container exists Check for the existence of a storage container.
az storage container generate-sas Generate a SAS token for a storage container.
az storage container immutability-policy Manage container immutability policies.
az storage container immutability-policy create Creates or updates an unlocked immutability policy.
az storage container immutability-policy delete Aborts an unlocked immutability policy.
az storage container immutability-policy extend Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy.
az storage container immutability-policy lock Sets the ImmutabilityPolicy to Locked state.
az storage container immutability-policy show Gets the existing immutability policy along with the corresponding ETag in response headers and body.
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 legal-hold Manage container legal holds.
az storage container legal-hold clear Clears legal hold tags.
az storage container legal-hold set Sets legal hold tags.
az storage container legal-hold show Get the legal hold properties of a container.
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 copy Copy files or directories to or from Azure storage.
az storage cors Manage storage service Cross-Origin Resource Sharing (CORS).
az storage cors add Add a CORS rule to a storage account.
az storage cors clear Remove all CORS rules from a storage account.
az storage cors list List all CORS rules for a storage account.
az storage directory Manage file storage directories.
az storage directory create Creates a new directory under the specified share or parent directory.
az storage directory delete Deletes the specified empty directory.
az storage directory exists Check for the existence of a storage directory.
az storage directory list List directories in a share.
az storage directory metadata Manage file storage directory metadata.
az storage directory metadata show Returns all user-defined metadata for the specified directory.
az storage directory metadata update Sets one or more user-defined name-value pairs for the specified directory.
az storage directory show Returns all user-defined metadata and system properties for the specified directory.
az storage entity Manage table storage entities.
az storage entity delete Deletes an existing entity in a table.
az storage entity insert Insert an entity into a table.
az storage entity merge Updates an existing entity by merging the entity's properties.
az storage entity query List entities which satisfy a query.
az storage entity replace Updates an existing entity in a table.
az storage entity show Get an entity from the specified table.
az storage file Manage file shares that use the SMB 3.0 protocol.
az storage file copy Manage file copy operations.
az storage file copy cancel Aborts a pending copy_file operation, and leaves a destination file with zero length and full metadata.
az storage file copy start Copies a file asynchronously.
az storage file copy start-batch Copy multiple files or blobs to a file share.
az storage file delete Marks the specified file for deletion.
az storage file delete-batch Delete files from an Azure Storage File Share.
az storage file download Downloads a file to a file path, with automatic chunking and progress notifications.
az storage file download-batch Download files from an Azure Storage File Share to a local directory in a batch operation.
az storage file exists Check for the existence of a file.
az storage file generate-sas Generates a shared access signature for the file.
az storage file list List files and directories in a share.
az storage file metadata Manage file metadata.
az storage file metadata show Returns all user-defined metadata for the specified file.
az storage file metadata update Sets user-defined metadata for the specified file as one or more name-value pairs.
az storage file resize Resizes a file to the specified size.
az storage file show Returns all user-defined metadata, standard HTTP properties, and system properties for the file.
az storage file update Sets system properties on the file.
az storage file upload Upload a file to a share that uses the SMB 3.0 protocol.
az storage file upload-batch Upload files from a local directory to an Azure Storage File Share in a batch operation.
az storage file url Create the url to access a file.
az storage logging Manage storage service logging information.
az storage logging show Show logging settings for a storage account.
az storage logging update Update logging settings for a storage account.
az storage message Manage queue storage messages.
az storage message clear Deletes all messages from the specified queue.
az storage message delete Deletes the specified message.
az storage message get Retrieves one or more messages from the front of the queue.
az storage message peek Retrieves one or more messages from the front of the queue, but does not alter the visibility of the message.
az storage message put Adds a new message to the back of the message queue.
az storage message update Updates the visibility timeout of a message.
az storage metrics Manage storage service metrics.
az storage metrics show Show metrics settings for a storage account.
az storage metrics update Update metrics settings for a storage account.
az storage queue Manage storage queues.
az storage queue create Creates a queue under the given account.
az storage queue delete Deletes the specified queue and any messages it contains.
az storage queue exists Returns a boolean indicating whether the queue exists.
az storage queue generate-sas Generates a shared access signature for the queue.
az storage queue list List queues in a storage account.
az storage queue metadata Manage the metadata for a storage queue.
az storage queue metadata show Retrieves user-defined metadata and queue properties on the specified queue.
az storage queue metadata update Sets user-defined metadata on the specified queue.
az storage queue policy Manage shared access policies for a storage queue.
az storage queue policy create Create a stored access policy on the containing object.
az storage queue policy delete Delete a stored access policy on a containing object.
az storage queue policy list List stored access policies on a containing object.
az storage queue policy show Show a stored access policy on a containing object.
az storage queue policy update Set a stored access policy on a containing object.
az storage queue stats Retrieves statistics related to replication for the Queue service.
az storage remove Delete blobs or files from Azure Storage.
az storage share Manage file shares.
az storage share create Creates a new share under the specified account.
az storage share delete Marks the specified share for deletion.
az storage share exists Check for the existence of a file share.
az storage share generate-sas Generates a shared access signature for the share.
az storage share list List the file shares in a storage account.
az storage share metadata Manage the metadata of a file share.
az storage share metadata show Returns all user-defined metadata for the specified share.
az storage share metadata update Sets one or more user-defined name-value pairs for the specified share.
az storage share policy Manage shared access policies of a storage file share.
az storage share policy create Create a stored access policy on the containing object.
az storage share policy delete Delete a stored access policy on a containing object.
az storage share policy list List stored access policies on a containing object.
az storage share policy show Show a stored access policy on a containing object.
az storage share policy update Set a stored access policy on a containing object.
az storage share show Returns all user-defined metadata and system properties for the specified share.
az storage share snapshot Creates a snapshot of an existing share under the specified account.
az storage share stats Gets the approximate size of the data stored on the share, rounded up to the nearest gigabyte.
az storage share update Sets service-defined properties for the specified share.
az storage share url Create a URI to access a file share.
az storage table Manage NoSQL key-value storage.
az storage table create Creates a new table in the storage account.
az storage table delete Deletes the specified table and any data it contains.
az storage table exists Returns a boolean indicating whether the table exists.
az storage table generate-sas Generates a shared access signature for the table.
az storage table list List tables in a storage account.
az storage table policy Manage shared access policies of a storage table.
az storage table policy create Create a stored access policy on the containing object.
az storage table policy delete Delete a stored access policy on a containing object.
az storage table policy list List stored access policies on a containing object.
az storage table policy show Show a stored access policy on a containing object.
az storage table policy update Set a stored access policy on a containing object.
az storage table stats Retrieves statistics related to replication for the Table service.

az storage copy

Copy files or directories to or from Azure storage.

az storage copy [--blob-type {AppendBlob, BlockBlob, PageBlob}]
[--destination]
[--destination-account-name]
[--destination-blob]
[--destination-container]
[--destination-file-path]
[--destination-local-path]
[--destination-share]
[--preserve-s2s-access-tier {false, true}]
[--put-md5]
[--recursive]
[--source]
[--source-account-name]
[--source-blob]
[--source-container]
[--source-file-path]
[--source-local-path]
[--source-share]
[--subscription]

Examples

Upload a single file to Azure Blob using url.

az storage copy -s /path/to/file.txt -d https://[account].blob.core.windows.net/[container]/[path/to/blob]

Upload a single file to Azure Blob using account name and container name.

az storage copy --source-local-path /path/to/file.txt --destination-account-name mystorageaccount --destination-container mycontainer

Upload a single file to Azure Blob with MD5 hash of the file content and save it as the blob's Content-MD5 property.

az storage copy -s /path/to/file.txt -d https://[account].blob.core.windows.net/[container]/[path/to/blob] --put-md5

Upload an entire directory to Azure Blob using url.

az storage copy -s /path/to/dir -d https://[account].blob.core.windows.net/[container]/[path/to/directory] --recursive

Upload an entire directory to Azure Blob using account name and container name.

az storage copy --source-local-path /path/to/dir --destination-account-name mystorageaccount --destination-container mycontainer --recursive

Upload a set of files to Azure Blob using wildcards with url.

az storage copy -s /path/*foo/*bar/*.pdf -d https://[account].blob.core.windows.net/[container]/[path/to/directory]

Upload a set of files to Azure Blob using wildcards with account name and container name.

az storage copy --source-local-path /path/*foo/*bar/*.pdf --destination-account-name mystorageaccount --destination-container mycontainer

Upload files and directories to Azure Blob using wildcards with url.

az storage copy -s /path/*foo/*bar* -d https://[account].blob.core.windows.net/[container]/[path/to/directory] --recursive

Upload files and directories to Azure Blob using wildcards with account name and container name.

az storage copy --source-local-path /path/*foo/*bar* --destination-account-name mystorageaccount --destination-container mycontainer --recursive

Download a single file from Azure Blob using url, and you can also specify your storage account and container information as above.

az storage copy -s https://[account].blob.core.windows.net/[container]/[path/to/blob] -d /path/to/file.txt

Download an entire directory from Azure Blob, and you can also specify your storage account and container information as above.

az storage copy -s https://[account].blob.core.windows.net/[container]/[path/to/directory] -d /path/to/dir --recursive

Download a set of files from Azure Blob using wildcards, and you can also specify your storage account and container information as above.

az storage copy -s https://[account].blob.core.windows.net/[container]/foo* -d /path/to/dir --recursive

Copy a single blob to another blob, and you can also specify the storage account and container information of source and destination as above.

az storage copy -s https://[srcaccount].blob.core.windows.net/[container]/[path/to/blob] -d https://[destaccount].blob.core.windows.net/[container]/[path/to/blob]

Copy an entire account data from blob account to another blob account, and you can also specify the storage account and container information of source and destination as above.

az storage copy -s https://[srcaccount].blob.core.windows.net -d https://[destaccount].blob.core.windows.net --recursive

Copy a single object from S3 with access key to blob, and you can also specify your storage account and container information as above.

az storage copy -s https://s3.amazonaws.com/[bucket]/[object] -d https://[destaccount].blob.core.windows.net/[container]/[path/to/blob]

Copy an entire directory from S3 with access key to blob virtual directory, and you can also specify your storage account and container information as above.

az storage copy -s https://s3.amazonaws.com/[bucket]/[folder] -d https://[destaccount].blob.core.windows.net/[container]/[path/to/directory] --recursive

Copy all buckets in S3 service with access key to blob account, and you can also specify your storage account information as above.

az storage copy -s https://s3.amazonaws.com/ -d https://[destaccount].blob.core.windows.net --recursive

Copy all buckets in a S3 region with access key to blob account, and you can also specify your storage account information as above.

az storage copy -s https://s3-[region].amazonaws.com/ -d https://[destaccount].blob.core.windows.net --recursive

Upload a single file to Azure File Share using url.

az storage copy -s /path/to/file.txt -d https://[account].file.core.windows.net/[share]/[path/to/file]

Upload a single file to Azure File Share using account name and share name.

az storage copy --source-local-path /path/to/file.txt --destination-account-name mystorageaccount --destination-share myshare

Upload an entire directory to Azure File Share using url.

az storage copy -s /path/to/dir -d https://[account].file.core.windows.net/[share]/[path/to/directory] --recursive

Upload an entire directory to Azure File Share using account name and container name.

az storage copy --source-local-path /path/to/dir --destination-account-name mystorageaccount --destination-share myshare --recursive

Upload a set of files to Azure File Share using wildcards with account name and share name.

az storage copy --source-local-path /path/*foo/*bar/*.pdf --destination-account-name mystorageaccount --destination-share myshare

Upload files and directories to Azure File Share using wildcards with url.

az storage copy -s /path/*foo/*bar* -d https://[account].file.core.windows.net/[share]/[path/to/directory] --recursive

Upload files and directories to Azure File Share using wildcards with account name and share name.

az storage copy --source-local-path /path/*foo/*bar* --destination-account-name mystorageaccount --destination-share myshare --recursive

Download a single file from Azure File Share using url, and you can also specify your storage account and share information as above.

az storage copy -s https://[account].file.core.windows.net/[share]/[path/to/file] -d /path/to/file.txt

Download an entire directory from Azure File Share, and you can also specify your storage account and share information as above.

az storage copy -s https://[account].file.core.windows.net/[share]/[path/to/directory] -d /path/to/dir --recursive

Download a set of files from Azure File Share using wildcards, and you can also specify your storage account and share information as above.

az storage copy -s https://[account].file.core.windows.net/[share]/foo* -d /path/to/dir --recursive

Optional Parameters

--blob-type

The type of blob at the destination.

accepted values: AppendBlob, BlockBlob, PageBlob
--destination -d

The path/url of copy destination. It can be a local path, an url to azure storage server. If you provide destination parameter here, you do not need to provide arguments in copy destination arguments group and copy destination arguments will be deprecated in future.

--destination-account-name

Storage account name of copy destination.

--destination-blob

Blob name in blob container of copy destination storage account.

--destination-container

Container name of copy destination storage account.

--destination-file-path

File path in file share of copy destination storage account.

--destination-local-path

Local file path.

--destination-share

File share name of copy destination storage account.

--preserve-s2s-access-tier

Preserve access tier during service to service copy. Please refer to https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers to ensure destination storage account support setting access tier. In the cases that setting access tier is not supported, please use --preserve-s2s-access-tier false to bypass copying access tier. (Default true).

accepted values: false, true
--put-md5

Create an MD5 hash of each file, and save the hash as the Content-MD5 property of the destination blob/file.Only available when uploading.

--recursive

Look into sub-directories recursively when uploading from local file system.

--source -s

The path/url of copy source. It can be a local path, an url to azure storage server or AWS S3 buckets. If you provide source parameter here, you do not need to provide arguments in copy source arguments group and copy source arguments will be deprecated in future.

--source-account-name

Storage account name of copy source.

--source-blob

Blob name in blob container of copy source storage account.

--source-container

Container name of copy source storage account.

--source-file-path

File path in file share of copy source storage account.

--source-local-path

Local file path.

--source-share

File share name of copy source storage account.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az storage remove

Delete blobs or files from Azure Storage.

az storage remove [--account-key]
[--account-name]
[--connection-string]
[--container-name]
[--exclude]
[--include]
[--name]
[--path]
[--recursive]
[--sas-token]
[--share-name]
[--subscription]

Examples

Remove a single blob.

az storage remove -c MyContainer -n MyBlob

Remove an entire virtual directory.

az storage remove -c MyContainer -n path/to/directory --recursive

Remove only the top blobs inside a virtual directory but not its sub-directories.

az storage remove -c MyContainer -n path/to/directory

Remove a subset of blobs in a virtual directory (For example, only jpg and pdf files, or if the blob name is "exactName").

az storage remove -c MyContainer -n path/to/directory --recursive --include "*.jpg;*.pdf;exactName"

Remove an entire virtual directory but exclude certain blobs from the scope (For example, every blob that starts with foo or ends with bar).

az storage remove -c MyContainer -n path/to/directory --recursive --include "foo*;*bar"

Remove a single file.

az storage remove -s MyShare -p MyFile

Remove an entire directory.

az storage remove -s MyShare -p path/to/directory --recursive

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.

--container-name -c

The container name.

--exclude

Exclude files whose name matches the pattern list.

--include

Only include files whose name matches the pattern list.

--name -n

The blob name.

--path -p

The path to the file within the file share.

--recursive -r

Look into sub-directories recursively when deleting between directories.

--sas-token

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

--share-name -s

The file share name.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.