az storage file

Manage files in Azure file shares.

Commands

Name Description Type Status
az storage file copy

Manage asynchronous file copy operations.

Core Preview
az storage file copy start

Start an asynchronous copy into a file.

Core Preview
az storage file create

Create an empty file.

Core Preview
az storage file delete

Delete a file.

Core Preview
az storage file download

Download a file to a local path.

Core Preview
az storage file list

List files and directories in a file share.

Core Preview
az storage file show

Show the properties of a file.

Core Preview
az storage file upload

Upload a local file to a file share.

Core Preview

az storage file create

Preview

Create an empty file.

Create a file in a file share without uploading content. Use --size to set the file length in bytes; the content is zero-filled.

az storage file create [--account-key]
                       [--account-name]
                       [--client-request-id]
                       [--content-cache-control]
                       [--content-disposition]
                       [--content-encoding]
                       [--content-language]
                       [--content-type]
                       [--metadata]
                       [--path]
                       [--sas-token]
                       [--share-name]
                       [--size]
                       [--timeout]
                       [--url]

Examples

Create an empty file

az storage file create --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare --path mydir/empty.txt

Create a 1 KiB file

az storage file create --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare --path mydir/sized.bin --size 1024

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

Storage account key.

--account-name

Storage account name. Used with the share name and file path when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--content-cache-control

The cache control of the file.

--content-disposition

The content disposition of the file.

--content-encoding

The content encoding of the file.

--content-language

The content language of the file.

--content-type

The content type of the file.

--metadata

Metadata in space-separated key=value pairs.

--path

The file path within the share, e.g. dir/file.txt. The directory must exist; an existing file is replaced.

--sas-token

A shared access signature. Alternative to --account-key.

--share-name

The share name.

--size

The file size in bytes. The file is created empty, filled with zeros.

--timeout

The timeout parameter is expressed in seconds.

--url

The file URL. Alternative to --account-name, --share-name and --path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage file delete

Preview

Delete a file.

Delete a file from a file share.

az storage file delete [--account-key]
                       [--account-name]
                       [--client-request-id]
                       [--path]
                       [--sas-token]
                       [--share-name]
                       [--timeout]
                       [--url]

Examples

Delete a file

az storage file delete --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare --path mydir/myfile.txt

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

Storage account key.

--account-name

Storage account name. Used with the share name and file path when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--path

The file path within the share, e.g. dir/file.txt.

--sas-token

A shared access signature. Alternative to --account-key.

--share-name

The share name.

--timeout

The timeout parameter is expressed in seconds.

--url

The file URL. Alternative to --account-name, --share-name and --path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage file download

Preview

Download a file to a local path.

Download the content of a file in a file share to a local file.

az storage file download [--account-key]
                         [--account-name]
                         [--client-request-id]
                         [--dest]
                         [--path]
                         [--sas-token]
                         [--share-name]
                         [--timeout]
                         [--url]

Examples

Download a file

az storage file download --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare --path mydir/myfile.txt --dest ./downloaded.txt

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

Storage account key.

--account-name

Storage account name. Used with the share name and file path when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--dest

Path of the local file to write. An existing file is not overwritten.

--path

The file path within the share, e.g. dir/file.txt.

--sas-token

A shared access signature. Alternative to --account-key.

--share-name

The share name.

--timeout

The timeout parameter is expressed in seconds.

--url

The file URL. Alternative to --account-name, --share-name and --path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage file list

Preview

List files and directories in a file share.

List the files and directories in a directory, or in the share root when --name isn't given. Continuation markers are followed until all pages are returned.

az storage file list [--account-key]
                     [--account-name]
                     [--client-request-id]
                     [--marker]
                     [--maxresults]
                     [--name]
                     [--prefix]
                     [--sas-token]
                     [--share-name]
                     [--snapshot]
                     [--timeout]
                     [--url]

Examples

List the share root

az storage file list --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare

List a directory

az storage file list --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare --name mydir

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

Storage account key.

--account-name

Storage account name. Used with the share name when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--marker

An opaque string value that identifies the portion of the result set to return with this operation.

--maxresults

Specifies the maximum number of entries, directories and files combined, the service scans per page.

--name

The directory path to list, e.g. parent/child. Lists the share root when not given.

--prefix

Filters the results to return only entries whose name begins with the specified prefix.

--sas-token

A shared access signature. Alternative to --account-key.

--share-name

The share name.

--snapshot

The share snapshot to list.

--timeout

The timeout parameter is expressed in seconds.

--url

The URL of the share or directory to list. Alternative to --account-name, --share-name and --name.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage file show

Preview

Show the properties of a file.

Get the system properties and metadata of a file, such as its content length and content type, without downloading its content.

az storage file show [--account-key]
                     [--account-name]
                     [--client-request-id]
                     [--path]
                     [--sas-token]
                     [--share-name]
                     [--snapshot]
                     [--timeout]
                     [--url]

Examples

Show a file

az storage file show --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare --path mydir/myfile.txt

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

Storage account key.

--account-name

Storage account name. Used with the share name and file path when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--path

The file path within the share, e.g. dir/file.txt.

--sas-token

A shared access signature. Alternative to --account-key.

--share-name

The share name.

--snapshot

The share snapshot to query.

--timeout

The timeout parameter is expressed in seconds.

--url

The file URL. Alternative to --account-name, --share-name and --path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.

az storage file upload

Preview

Upload a local file to a file share.

Upload a local file to a path in a file share. The parent directory must already exist.

az storage file upload [--account-key]
                       [--account-name]
                       [--client-request-id]
                       [--content-cache-control]
                       [--content-disposition]
                       [--content-encoding]
                       [--content-language]
                       [--content-type]
                       [--metadata]
                       [--path]
                       [--sas-token]
                       [--share-name]
                       [--source]
                       [--timeout]
                       [--url]

Examples

Upload a file

az storage file upload --account-name mystorageaccount --account-key $ACCOUNT_KEY --share-name myshare --path mydir/myfile.txt --source ./myfile.txt

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--account-key

Storage account key.

--account-name

Storage account name. Used with the share name and file path when --url is not given.

--client-request-id

An opaque, globally-unique, client-generated string identifier for the request.

--content-cache-control

The cache control of the file.

--content-disposition

The content disposition of the file.

--content-encoding

The content encoding of the file.

--content-language

The content language of the file.

--content-type

The content type of the file.

--metadata

Metadata in space-separated key=value pairs.

--path

The destination file path within the share, e.g. dir/file.txt. The directory must exist; an existing file is replaced.

--sas-token

A shared access signature. Alternative to --account-key.

--share-name

The share name.

--source

Path of the local file to upload.

--timeout

The timeout parameter is expressed in seconds.

--url

The file URL. Alternative to --account-name, --share-name and --path.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

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

JMESPath query string to filter/project the command result before rendering.