az storage cors

Manage storage service Cross-Origin Resource Sharing (CORS).

Commands

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

Add a CORS rule to a storage account.

az storage cors add --methods {DELETE, GET, HEAD, MERGE, OPTIONS, POST, PUT}
                    --origins
                    --services
                    [--account-key]
                    [--account-name]
                    [--allowed-headers]
                    [--connection-string]
                    [--exposed-headers]
                    [--max-age]
                    [--sas-token]
                    [--subscription]
                    [--timeout]

Required Parameters

--methods

Space-separated list of HTTP methods allowed to be executed by the origin.

accepted values: DELETE, GET, HEAD, MERGE, OPTIONS, POST, PUT
--origins

Space-separated list of origin domains that will be allowed via CORS, or '*' to allow all domains.

--services

The storage service(s) to add rules to. Allowed options are: (b)lob, (f)ile, (q)ueue, (t)able. Can be combined.

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.

--allowed-headers

Space-separated list of response headers allowed to be part of the cross-origin request.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--exposed-headers

Space-separated list of response headers to expose to CORS clients.

--max-age

The maximum number of seconds the client/browser should cache a preflight response.

--sas-token

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

--subscription

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

--timeout

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

az storage cors clear

Remove all CORS rules from a storage account.

az storage cors clear --services
                      [--account-key]
                      [--account-name]
                      [--connection-string]
                      [--sas-token]
                      [--subscription]
                      [--timeout]

Examples

Remove all CORS rules from a storage account. (autogenerated)

az storage cors clear --account-name MyAccount --services bfqt

Required Parameters

--services

The storage service(s) to remove rules from. Allowed options are: (b)lob, (f)ile, (q)ueue, (t)able. Can be combined.

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.

--subscription

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

--timeout

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

az storage cors list

List all CORS rules for a storage account.

az storage cors list [--account-key]
                     [--account-name]
                     [--connection-string]
                     [--query-examples]
                     [--sas-token]
                     [--services]
                     [--subscription]
                     [--timeout]

Examples

List all CORS rules for a storage account. (autogenerated)

az storage cors list --account-key 00000000 --account-name mystorageaccount

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.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--sas-token

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

--services

The storage service(s) to list rules for. Allowed options are: (b)lob, (f)ile, (q)ueue, (t)able. Can be combined.

default value: bqft
--subscription

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

--timeout

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