az storage fs file

Manage files in Azure Data Lake Storage Gen2 account.

Commands

az storage fs file append

Append content to a file in ADLS Gen2 file system.

az storage fs file create

Create a new file in ADLS Gen2 file system.

az storage fs file delete

Delete a file in ADLS Gen2 file system.

az storage fs file download

Download a file from the specified path in ADLS Gen2 file system.

az storage fs file exists

Check for the existence of a file in ADLS Gen2 file system.

az storage fs file list

List files and directories in ADLS Gen2 file system.

az storage fs file metadata

Manage the metadata for file in file system.

az storage fs file metadata show

Returns all user-defined metadata, standard HTTP properties, and system properties for the file.

az storage fs file metadata update

Sets one or more user-defined name-value pairs for the specified file system.

az storage fs file move

Move a file in ADLS Gen2 Account.

az storage fs file show

Show properties of file in ADLS Gen2 file system.

az storage fs file upload

Upload a file to a file path in ADLS Gen2 file system.

az storage fs file append

Append content to a file in ADLS Gen2 file system.

az storage fs file append --content
                          --file-system
                          --path
                          [--account-key]
                          [--account-name]
                          [--auth-mode {key, login}]
                          [--connection-string]
                          [--sas-token]
                          [--subscription]
                          [--timeout]

Examples

Append content to a file in ADLS Gen2 file system.

az storage fs file append --content "test content test" -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--content

Content to be appended to file.

--file-system -f

File system name.

--path -p

The file path in a file system.

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
--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 fs file create

Create a new file in ADLS Gen2 file system.

az storage fs file create --file-system
                          --path
                          [--account-key]
                          [--account-name]
                          [--auth-mode {key, login}]
                          [--connection-string]
                          [--content-cache-control]
                          [--content-disposition]
                          [--content-encoding]
                          [--content-language]
                          [--content-md5]
                          [--content-type]
                          [--metadata]
                          [--permissions]
                          [--sas-token]
                          [--subscription]
                          [--timeout]
                          [--umask]

Examples

Create a new file in ADLS Gen2 file system.

az storage fs file create -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system name.

--path -p

The file path in a file system.

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
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content-cache-control

The cache control string.

--content-disposition

Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.

--content-encoding

The content encoding type.

--content-language

The content language.

--content-md5

The content's MD5 hash.

--content-type

The content MIME type.

--metadata

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

--permissions

POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. For more information, please refer to https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-access-control#levels-of-permission.

--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.

--umask

When creating a file or directory and the parent folder does not have a default ACL, the umask restricts the permissions of the file or directory to be created. The resulting permission is given by p & ^u, where p is the permission and u is the umask. For more information, please refer to https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-access-control#umask.

az storage fs file delete

Delete a file in ADLS Gen2 file system.

az storage fs file delete --file-system
                          --path
                          [--account-key]
                          [--account-name]
                          [--auth-mode {key, login}]
                          [--connection-string]
                          [--sas-token]
                          [--subscription]
                          [--timeout]
                          [--yes]

Examples

Delete a file in ADLS Gen2 file system.

az storage fs file delete -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system name.

--path -p

The file path in a file system.

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
--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.

--yes -y

Do not prompt for confirmation.

az storage fs file download

Download a file from the specified path in ADLS Gen2 file system.

az storage fs file download --file-system
                            --path
                            [--account-key]
                            [--account-name]
                            [--auth-mode {key, login}]
                            [--connection-string]
                            [--destination]
                            [--overwrite {false, true}]
                            [--sas-token]
                            [--subscription]
                            [--timeout]

Examples

Download a file in ADLS Gen2 file system to current path.

az storage fs file download -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Download a file in ADLS Gen2 file system to a specified directory.

az storage fs file download -p dir/a.txt -d test/ -f fsname --account-name myadlsaccount --account-key 0000-0000

Download a file in ADLS Gen2 file system to a specified file path.

az storage fs file download -p dir/a.txt -d test/b.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system name.

--path -p

The file path in a file system.

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
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--destination -d

The local file where the file or folder will be downloaded to. The source filename will be used if not specified.

--overwrite

Overwrite an existing file when specified. Default value is false.

accepted values: false, true
default value: 1
--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 fs file exists

Check for the existence of a file in ADLS Gen2 file system.

az storage fs file exists --file-system
                          --path
                          [--account-key]
                          [--account-name]
                          [--auth-mode {key, login}]
                          [--connection-string]
                          [--sas-token]
                          [--subscription]
                          [--timeout]

Examples

Check for the existence of a file in ADLS Gen2 file system.

az storage fs file exists -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system name.

--path -p

The file path in a file system.

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
--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 fs file list

List files and directories in ADLS Gen2 file system.

az storage fs file list --file-system
                        [--account-key]
                        [--account-name]
                        [--auth-mode {key, login}]
                        [--connection-string]
                        [--exclude-dir]
                        [--marker]
                        [--num-results]
                        [--path]
                        [--query-examples]
                        [--recursive {false, true}]
                        [--sas-token]
                        [--subscription]
                        [--timeout]

Examples

List files and directories in ADLS Gen2 file system.

az storage fs file list -f fsname --account-name myadlsaccount --account-key 0000-0000

List files in ADLS Gen2 file system.

az storage fs file list --exclude-dir -f fsname --account-name myadlsaccount --account-key 0000-0000

List files and directories in a specified path.

az storage fs file list --path dir -f fsname --account-name myadlsaccount --account-key 0000-0000

List files and directories from a specific marker.

az storage fs file list --marker "VBaS6LvPufaqrTANTQvbmV3dHJ5FgAAAA==" -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system 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
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--exclude-dir

List only files in the given file system.

--marker

An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object. If specified, this generator will begin returning results from this point.

--num-results

Specify the maximum number of results to return. If the request does not specify num_results or specifies a value greater than 5,000, the server will return up to 5,000 items.

default value: 5000
--path

Filter the results to return only paths under the specified path.

--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.

--recursive

Look into sub-directories recursively when set to true.

accepted values: false, true
default value: 1
--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 fs file move

Move a file in ADLS Gen2 Account.

az storage fs file move --file-system
                        --new-path
                        --path
                        [--account-key]
                        [--account-name]
                        [--auth-mode {key, login}]
                        [--connection-string]
                        [--content-cache-control]
                        [--content-disposition]
                        [--content-encoding]
                        [--content-language]
                        [--content-md5]
                        [--content-type]
                        [--sas-token]
                        [--subscription]

Examples

Move a file in ADLS Gen2 Account.

az storage fs file move --new-path new-fs/new-dir/b.txt -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system name.

--new-path

The new path the users want to move to. The value must have the following format: "{filesystem}/{directory}/{subdirectory}/{file}".

--path -p

The original file path users want to move in a file system.

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
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content-cache-control

The cache control string.

--content-disposition

Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.

--content-encoding

The content encoding type.

--content-language

The content language.

--content-md5

The content's MD5 hash.

--content-type

The content MIME type.

--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.

az storage fs file show

Show properties of file in ADLS Gen2 file system.

az storage fs file show --file-system
                        --path
                        [--account-key]
                        [--account-name]
                        [--auth-mode {key, login}]
                        [--connection-string]
                        [--query-examples]
                        [--sas-token]
                        [--subscription]
                        [--timeout]

Examples

Show properties of file in ADLS Gen2 file system.

az storage fs file show -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system name.

--path -p

The file path in a file system.

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
--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.

--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 fs file upload

Upload a file to a file path in ADLS Gen2 file system.

az storage fs file upload --file-system
                          --path
                          --source
                          [--account-key]
                          [--account-name]
                          [--auth-mode {key, login}]
                          [--connection-string]
                          [--content-cache-control]
                          [--content-disposition]
                          [--content-encoding]
                          [--content-language]
                          [--content-md5]
                          [--content-type]
                          [--if-match]
                          [--if-modified-since]
                          [--if-none-match]
                          [--if-unmodified-since]
                          [--metadata]
                          [--overwrite {false, true}]
                          [--permissions]
                          [--sas-token]
                          [--subscription]
                          [--timeout]
                          [--umask]

Examples

Upload a file from local path to a file path in ADLS Gen2 file system.

az storage fs file upload --source a.txt -p dir/a.txt -f fsname --account-name myadlsaccount --account-key 0000-0000

Required Parameters

--file-system -f

File system name.

--path -p

The file path in a file system.

--source -s

Path of the local file to upload as the file content.

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
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content-cache-control

The cache control string.

--content-disposition

Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.

--content-encoding

The content encoding type.

--content-language

The content language.

--content-md5

The content's MD5 hash.

--content-type

The content MIME type.

--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

--if-modified-since

A Commence only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--if-none-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag does not match the value specified.

--if-unmodified-since

A Commence only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--metadata

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

--overwrite

Overwrite an existing file when specified.

accepted values: false, true
--permissions

POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. For more information, please refer to https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-access-control#levels-of-permission.

--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.

--umask

When creating a file or directory and the parent folder does not have a default ACL, the umask restricts the permissions of the file or directory to be created. The resulting permission is given by p & ^u, where p is the permission and u is the umask. For more information, please refer to https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-access-control#umask.