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
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.
Storage account key.
Storage account name. Used with the share name and file path when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The cache control of the file.
The content disposition of the file.
The content encoding of the file.
The content language of the file.
The content type of the file.
Metadata in space-separated key=value pairs.
The file path within the share, e.g. dir/file.txt. The directory must exist; an existing file is replaced.
A shared access signature. Alternative to --account-key.
The share name.
The file size in bytes. The file is created empty, filled with zeros.
The timeout parameter is expressed in seconds.
The file URL. Alternative to --account-name, --share-name and --path.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage file delete
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.
Storage account key.
Storage account name. Used with the share name and file path when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The file path within the share, e.g. dir/file.txt.
A shared access signature. Alternative to --account-key.
The share name.
The timeout parameter is expressed in seconds.
The file URL. Alternative to --account-name, --share-name and --path.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage file download
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.
Storage account key.
Storage account name. Used with the share name and file path when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
Path of the local file to write. An existing file is not overwritten.
The file path within the share, e.g. dir/file.txt.
A shared access signature. Alternative to --account-key.
The share name.
The timeout parameter is expressed in seconds.
The file URL. Alternative to --account-name, --share-name and --path.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage file list
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.
Storage account key.
Storage account name. Used with the share name when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
An opaque string value that identifies the portion of the result set to return with this operation.
Specifies the maximum number of entries, directories and files combined, the service scans per page.
The directory path to list, e.g. parent/child. Lists the share root when not given.
Filters the results to return only entries whose name begins with the specified prefix.
A shared access signature. Alternative to --account-key.
The share name.
The share snapshot to list.
The timeout parameter is expressed in seconds.
The URL of the share or directory to list. Alternative to --account-name, --share-name and --name.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage file show
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.
Storage account key.
Storage account name. Used with the share name and file path when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The file path within the share, e.g. dir/file.txt.
A shared access signature. Alternative to --account-key.
The share name.
The share snapshot to query.
The timeout parameter is expressed in seconds.
The file URL. Alternative to --account-name, --share-name and --path.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az storage file upload
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.
Storage account key.
Storage account name. Used with the share name and file path when --url is not given.
An opaque, globally-unique, client-generated string identifier for the request.
The cache control of the file.
The content disposition of the file.
The content encoding of the file.
The content language of the file.
The content type of the file.
Metadata in space-separated key=value pairs.
The destination file path within the share, e.g. dir/file.txt. The directory must exist; an existing file is replaced.
A shared access signature. Alternative to --account-key.
The share name.
Path of the local file to upload.
The timeout parameter is expressed in seconds.
The file URL. Alternative to --account-name, --share-name and --path.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.