Share via


az storage share

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage file shares.

Commands

Name Description Type Status
az storage share close-handle

Close file handles of a file share.

Core GA
az storage share close-handle (storage-preview extension)

Close file handles of a file share.

Extension GA
az storage share create

Creates a new share under the specified account.

Core GA
az storage share delete

Mark the specified share for deletion.

Core GA
az storage share exists

Check for the existence of a file share.

Core GA
az storage share generate-sas

Generate a shared access signature for the share.

Core GA
az storage share list

List the file shares in a storage account.

Core GA
az storage share list-handle

List file handles of a file share.

Core GA
az storage share list-handle (storage-preview extension)

List file handles of a file share.

Extension GA
az storage share metadata

Manage the metadata of a file share.

Core GA
az storage share metadata show

Return all user-defined metadata for the specified share.

Core GA
az storage share metadata update

Set one or more user-defined name-value pairs for the specified share.

Core GA
az storage share policy

Manage shared access policies of a storage file share.

Core GA
az storage share policy create

Create a stored access policy on the containing object.

Core GA
az storage share policy delete

Delete a stored access policy on a containing object.

Core GA
az storage share policy list

List stored access policies on a containing object.

Core GA
az storage share policy show

Show a stored access policy on a containing object.

Core GA
az storage share policy update

Set a stored access policy on a containing object.

Core GA
az storage share show

Return all user-defined metadata and system properties for the specified share.

Core GA
az storage share snapshot

Create a snapshot of an existing share under the specified account.

Core GA
az storage share stats

Get the approximate size of the data stored on the share, rounded up to the nearest gigabyte.

Core GA
az storage share update

Set service-defined properties for the specified share.

Core GA
az storage share url

Create a URI to access a file share.

Core GA

az storage share close-handle

Close file handles of a file share.

az storage share close-handle --name
                              [--account-key]
                              [--account-name]
                              [--auth-mode {key, login}]
                              [--backup-intent]
                              [--close-all {false, true}]
                              [--connection-string]
                              [--disallow-trailing-dot {false, true}]
                              [--file-endpoint]
                              [--handle-id]
                              [--path]
                              [--recursive {false, true}]
                              [--sas-token]
                              [--snapshot]
                              [--timeout]

Examples

Close all file handles of a file share recursively.

az storage share close-handle --account-name MyAccount --name MyFileShare --close-all --recursive
az storage share close-handle --account-name MyAccount --name MyFileShare --handle-id "*" --recursive

Close all file handles of a file directory recursively.

az storage share close-handle --account-name MyAccount --name MyFileShare --path 'dir1' --close-all --recursive

Close all file handles of a file.

az storage share close-handle --account-name MyAccount --name MyFileShare --path 'dir1/test.txt' --close-all

Close file handle with a specific handle-id of a file.

az storage share close-handle --account-name MyAccount --name MyFileShare --path 'dir1/test.txt' --handle-id "id"

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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
--backup-intent --enable-file-backup-request-intent

Required parameter to use with OAuth (Azure AD) Authentication for Files. This will bypass any file/directory level permission checks and allow access, based on the allowed data actions, even if there are ACLs in place for those files/directories.

Default value: False
--close-all

Whether or not to close all the file handles. Specify close-all or a specific handle-id.

Accepted values: false, true
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--disallow-trailing-dot

If true, the trailing dot will be trimmed from the target URI. Default to False.

Accepted values: false, true
Default value: False
--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--handle-id

Specifies handle ID opened on the file or directory to be closed. Astrix (‘*’) is a wildcard that specifies all handles.

--path -p

The path to the file/directory within the file share.

--recursive

Boolean that specifies if operation should apply to the directory specified in the URI, its files, with its subdirectories and their files.

Accepted values: false, true
--sas-token

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

--snapshot

A string that represents the snapshot version, if applicable.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share close-handle (storage-preview extension)

Close file handles of a file share.

az storage share close-handle --name
                              [--account-key]
                              [--account-name]
                              [--auth-mode {key, login}]
                              [--backup-intent]
                              [--close-all {false, true}]
                              [--connection-string]
                              [--disallow-trailing-dot {false, true}]
                              [--handle-id]
                              [--path]
                              [--recursive {false, true}]
                              [--sas-token]
                              [--snapshot]
                              [--timeout]

Examples

Close all file handles of a file share recursively.

az storage share close-handle --account-name MyAccount --name MyFileShare --close-all --recursive
az storage share close-handle --account-name MyAccount --name MyFileShare --handle-id "*" --recursive

Close all file handles of a file directory recursively.

az storage share close-handle --account-name MyAccount --name MyFileShare --path 'dir1' --close-all --recursive

Close all file handles of a file.

az storage share close-handle --account-name MyAccount --name MyFileShare --path 'dir1/test.txt' --close-all

Close file handle with a specific handle-id of a file.

az storage share close-handle --account-name MyAccount --name MyFileShare --path 'dir1/test.txt' --handle-id "id"

Required Parameters

--name -n

The file share 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
--backup-intent --enable-file-backup-request-intent

Required parameter to use with OAuth (Azure AD) Authentication for Files. This will bypass any file/directory level permission checks and allow access, based on the allowed data actions, even if there are ACLs in place for those files/directories.

Default value: False
--close-all

Whether or not to close all the file handles. Specify close-all or a specific handle-id.

Accepted values: false, true
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--disallow-trailing-dot

If true, the trailing dot will be trimmed from the target URI. Default to False.

Accepted values: false, true
Default value: False
--handle-id

Specifies handle ID opened on the file or directory to be closed. Astrix (‘*’) is a wildcard that specifies all handles.

--path -p

The path to the file/directory within the file share.

--recursive

Boolean that specifies if operation should apply to the directory specified in the URI, its files, with its subdirectories and their files.

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.

--snapshot

A string that represents the snapshot version, if applicable.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share create

Creates a new share under the specified account.

az storage share create --name
                        [--account-key]
                        [--account-name]
                        [--connection-string]
                        [--fail-on-exist]
                        [--file-endpoint]
                        [--metadata]
                        [--quota]
                        [--sas-token]
                        [--timeout]

Examples

Creates a new share under the specified account. (autogenerated)

az storage share create --account-name MyAccount --name MyFileShare

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--fail-on-exist

Specify whether to throw an exception when the share exists. False by default.

Default value: False
--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--metadata

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

--quota

Specifies the maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120).

--sas-token

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

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share delete

Mark the specified share for deletion.

If the share does not exist, the operation fails on the service. By default, the exception is swallowed by the client. To expose the exception, specify True for fail_not_exist.

az storage share delete --name
                        [--account-key]
                        [--account-name]
                        [--connection-string]
                        [--delete-snapshots {include, include-leased}]
                        [--fail-not-exist]
                        [--file-endpoint]
                        [--sas-token]
                        [--snapshot]
                        [--timeout]

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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

Specify the deletion strategy when the share has snapshots.

Accepted values: include, include-leased
--fail-not-exist

Specify whether to throw an exception when the share doesn't exists. False by default.

Default value: False
--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

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

--snapshot

A string that represents the snapshot version, if applicable.Specify this argument to delete a specific snapshot only. delete_snapshots must be None if this is specified.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share exists

Check for the existence of a file share.

az storage share exists --name
                        [--account-key]
                        [--account-name]
                        [--connection-string]
                        [--file-endpoint]
                        [--sas-token]
                        [--snapshot]
                        [--timeout]

Examples

Check for the existence of a file share. (autogenerated)

az storage share exists --account-key 00000000 --account-name MyAccount --name MyFileShare

Check for the existence of a file share (autogenerated)

az storage share exists --connection-string $connectionString --name MyFileShare

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

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

--snapshot

A string that represents the snapshot version, if applicable.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share generate-sas

Generate a shared access signature for the share.

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

Examples

Generate a sas token for a fileshare and use it to upload a file.

end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
sas=`az storage share generate-sas -n MyShare --account-name MyStorageAccount --https-only --permissions dlrw --expiry $end -o tsv`
az storage file upload -s MyShare --account-name MyStorageAccount --source file.txt  --sas-token $sas

Generate a shared access signature for the share. (autogenerated)

az storage share generate-sas --account-key 00000000 --account-name MyStorageAccount --expiry 2037-12-31T23:59:00Z --name MyShare --permissions dlrw

Generate a shared access signature for the share. (autogenerated)

az storage share generate-sas --connection-string $connectionString --expiry 2019-02-01T12:20Z --name MyShare --permissions dlrw

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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 --policy-name that specifies this value.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--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: (c)reate (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 share's ACL.

--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 --policy-name that specifies this value. Defaults to the time of the request.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share list

List the file shares in a storage account.

az storage share list [--account-key]
                      [--account-name]
                      [--connection-string]
                      [--file-endpoint]
                      [--include-metadata]
                      [--include-snapshots]
                      [--marker]
                      [--num-results]
                      [--prefix]
                      [--sas-token]
                      [--timeout]

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--include-metadata

Specifies that share metadata be returned in the response.

Default value: False
--include-snapshots

Specifies that share snapshots be returned in the response.

Default value: False
--marker

An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object if num_results was specified and that generator has finished enumerating results. 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 or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share list-handle

List file handles of a file share.

az storage share list-handle --name
                             [--account-key]
                             [--account-name]
                             [--auth-mode {key, login}]
                             [--backup-intent]
                             [--connection-string]
                             [--disallow-trailing-dot {false, true}]
                             [--file-endpoint]
                             [--marker]
                             [--max-results]
                             [--path]
                             [--recursive {false, true}]
                             [--sas-token]
                             [--snapshot]
                             [--timeout]

Examples

List all file handles of a file share recursively.

az storage share list-handle --account-name MyAccount --name MyFileShare --recursive

List all file handles of a file directory recursively.

az storage share list-handle --account-name MyAccount --name MyFileShare --path 'dir1' --recursive

List all file handles of a file.

az storage share list-handle --account-name MyAccount --name MyFileShare --path 'dir1/test.txt'

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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
--backup-intent --enable-file-backup-request-intent

Required parameter to use with OAuth (Azure AD) Authentication for Files. This will bypass any file/directory level permission checks and allow access, based on the allowed data actions, even if there are ACLs in place for those files/directories.

Default value: False
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--disallow-trailing-dot

If true, the trailing dot will be trimmed from the target URI. Default to False.

Accepted values: false, true
Default value: False
--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--marker

An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object if max_results was specified and that generator has finished enumerating results. If specified, this generator will begin returning results from the point where the previous generator stopped.

--max-results

Specifies the maximum number of handles taken on files and/or directories to return. If the request does not specify max_results or specifies a value greater than 5,000, the server will return up to 5,000 items. Setting max_results to a value less than or equal to zero results in error response code 400 (Bad Request).

--path -p

The path to the file/directory within the file share.

--recursive

Boolean that specifies if operation should apply to the directory specified in the URI, its files, with its subdirectories and their files.

Accepted values: false, true
--sas-token

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

--snapshot

A string that represents the snapshot version, if applicable.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share list-handle (storage-preview extension)

List file handles of a file share.

az storage share list-handle --name
                             [--account-key]
                             [--account-name]
                             [--auth-mode {key, login}]
                             [--backup-intent]
                             [--connection-string]
                             [--disallow-trailing-dot {false, true}]
                             [--marker]
                             [--max-results]
                             [--path]
                             [--recursive {false, true}]
                             [--sas-token]
                             [--snapshot]
                             [--timeout]

Examples

List all file handles of a file share recursively.

az storage share list-handle --account-name MyAccount --name MyFileShare --recursive

List all file handles of a file directory recursively.

az storage share list-handle --account-name MyAccount --name MyFileShare --path 'dir1' --recursive

List all file handles of a file.

az storage share list-handle --account-name MyAccount --name MyFileShare --path 'dir1/test.txt'

Required Parameters

--name -n

The file share 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
--backup-intent --enable-file-backup-request-intent

Required parameter to use with OAuth (Azure AD) Authentication for Files. This will bypass any file/directory level permission checks and allow access, based on the allowed data actions, even if there are ACLs in place for those files/directories.

Default value: False
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--disallow-trailing-dot

If true, the trailing dot will be trimmed from the target URI. Default to False.

Accepted values: false, true
Default value: False
--marker

An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object if max_results was specified and that generator has finished enumerating results. If specified, this generator will begin returning results from the point where the previous generator stopped.

--max-results

Specifies the maximum number of handles taken on files and/or directories to return. If the request does not specify max_results or specifies a value greater than 5,000, the server will return up to 5,000 items. Setting max_results to a value less than or equal to zero results in error response code 400 (Bad Request).

--path -p

The path to the file/directory within the file share.

--recursive

Boolean that specifies if operation should apply to the directory specified in the URI, its files, with its subdirectories and their files.

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.

--snapshot

A string that represents the snapshot version, if applicable.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share show

Return all user-defined metadata and system properties for the specified share.

The data returned does not include the shares's list of files or directories.

az storage share show --name
                      [--account-key]
                      [--account-name]
                      [--connection-string]
                      [--file-endpoint]
                      [--sas-token]
                      [--snapshot]
                      [--timeout]

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

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

--snapshot

A string that represents the snapshot version, if applicable.

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share snapshot

Create a snapshot of an existing share under the specified account.

az storage share snapshot --name
                          [--account-key]
                          [--account-name]
                          [--connection-string]
                          [--file-endpoint]
                          [--metadata]
                          [--quota]
                          [--sas-token]
                          [--timeout]

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--metadata

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

--quota

Specifies the maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5 TB (5120 GB).

--sas-token

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

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share stats

Get the approximate size of the data stored on the share, rounded up to the nearest gigabyte.

Note that this value may not include all recently created or recently re-sized files.

az storage share stats --name
                       [--account-key]
                       [--account-name]
                       [--connection-string]
                       [--file-endpoint]
                       [--sas-token]
                       [--timeout]

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

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

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share update

Set service-defined properties for the specified share.

az storage share update --name
                        --quota
                        [--account-key]
                        [--account-name]
                        [--connection-string]
                        [--file-endpoint]
                        [--sas-token]
                        [--timeout]

Required Parameters

--name -n

The file share name.

--quota

Specifies the maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5 TB (5120 GB).

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

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

--timeout

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az storage share url

Create a URI to access a file share.

az storage share url --name
                     [--account-key]
                     [--account-name]
                     [--connection-string]
                     [--file-endpoint]
                     [--protocol {http, https}]
                     [--sas-token]
                     [--unc]

Examples

Create a URI to access a file share. (autogenerated)

az storage share url --account-key 00000000 --account-name MyAccount --name MyFileShare

Required Parameters

--name -n

The file share name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. 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.

--file-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--protocol

Protocol to use.

Accepted values: http, https
Default value: https
--sas-token

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

--unc

Output UNC network path.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.