az storage file copy

Manage file copy operations.

Commands

az storage file copy cancel

Aborts a pending copy_file operation, and leaves a destination file with zero length and full metadata.

az storage file copy start

Copy a file asynchronously.

az storage file copy start-batch

Copy multiple files or blobs to a file share.

az storage file copy cancel

Aborts a pending copy_file operation, and leaves a destination file with zero length and full metadata.

az storage file copy cancel --copy-id
                            --destination-path
                            --destination-share
                            [--account-key]
                            [--account-name]
                            [--connection-string]
                            [--sas-token]
                            [--subscription]
                            [--timeout]

Required Parameters

--copy-id

Copy identifier provided in the copy.id of the original copy_file operation.

--destination-path -p

The path to the file within the file share.

--destination-share -s

Name of the destination share. The share must exist.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--sas-token

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

--subscription

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

--timeout

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

az storage file copy start

Copy a file asynchronously.

az storage file copy start --destination-path
                           --destination-share
                           [--account-key]
                           [--account-name]
                           [--connection-string]
                           [--file-snapshot]
                           [--metadata]
                           [--sas-token]
                           [--source-account-key]
                           [--source-account-name]
                           [--source-blob]
                           [--source-container]
                           [--source-path]
                           [--source-sas]
                           [--source-share]
                           [--source-snapshot]
                           [--source-uri]
                           [--subscription]
                           [--timeout]

Examples

Copy a file asynchronously.

az storage file copy start --source-account-name srcaccount --source-account-key 00000000 --source-path <srcpath-to-file> --source-share srcshare --destination-path <destpath-to-file> --destination-share destshare --account-name destaccount --account-key 00000000

Copy a file asynchronously from source uri to destination storage account with sas token.

az storage file copy start --source-uri "https://srcaccount.file.core.windows.net/myshare/mydir/myfile?<sastoken>" --destination-path <destpath-to-file> --destination-share destshare --account-name destaccount --sas-token <destinaition-sas>

Copy a file asynchronously from file snapshot to destination storage account with sas token.

az storage file copy start --source-account-name srcaccount --source-account-key 00000000 --source-path <srcpath-to-file> --source-share srcshare --file-snapshot "2020-03-02T13:51:54.0000000Z" --destination-path <destpath-to-file> --destination-share destshare --account-name destaccount --sas-token <destinaition-sas>

Required Parameters

--destination-path -p

The path to the file within the file share.

--destination-share -s

Name of the destination share. The share must exist.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--file-snapshot

The file snapshot for the source storage account.

--metadata

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

--sas-token

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

--source-account-key

The storage account key of the source blob.

--source-account-name

The storage account name of the source blob.

--source-blob

The blob name for the source storage account.

--source-container

The container name for the source storage account.

--source-path

The file path for the source storage account.

--source-sas

The shared access signature for the source storage account.

--source-share

The share name for the source storage account.

--source-snapshot

The blob snapshot for the source storage account.

--source-uri -u

A URL of up to 2 KB in length that specifies an Azure file or blob. The value should be URL-encoded as it would appear in a request URI. If the source is in another account, the source must either be public or must be authenticated via a shared access signature. If the source is public, no authentication is required. Examples: https://myaccount.file.core.windows.net/myshare/mydir/myfile https://otheraccount.file.core.windows.net/myshare/mydir/myfile?sastoken.

--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 file copy start-batch

Copy multiple files or blobs to a file share.

az storage file copy start-batch [--account-key]
                                 [--account-name]
                                 [--connection-string]
                                 [--destination-path]
                                 [--destination-share]
                                 [--dryrun]
                                 [--metadata]
                                 [--pattern]
                                 [--sas-token]
                                 [--source-account-key]
                                 [--source-account-name]
                                 [--source-container]
                                 [--source-sas]
                                 [--source-share]
                                 [--source-uri]
                                 [--subscription]
                                 [--timeout]

Examples

Copy all files in a file share to another storage account.

az storage file copy start-batch --source-account-name srcaccount --source-account-key 00000000 --source-share srcshare --destination-path <destpath-to-directory> --destination-share destshare --account-name destaccount --account-key 00000000

Copy all files in a file share to another storage account. with sas token.

az storage file copy start-batch --source-uri "https://srcaccount.file.core.windows.net/myshare?<sastoken>" --destination-path <destpath-to-directory> --destination-share destshare --account-name destaccount --sas-token <destinaition-sas>

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--destination-path

The directory where the source data is copied to. If omitted, data is copied to the root directory.

--destination-share

The file share where the source data is copied to.

--dryrun

List the files and blobs to be copied. No actual data transfer will occur.

--metadata

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

--pattern

The pattern used for globbing files and blobs. The supported patterns are '*', '?', '[seq]', and '[!seq]'. For more information, please refer to https://docs.python.org/3.7/library/fnmatch.html.

--sas-token

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

--source-account-key

The account key for the source storage account. If omitted, the active login is used to determine the account key.

--source-account-name

The source storage account to copy the data from. If omitted, the destination account is used.

--source-container

The source container blobs are copied from.

--source-sas

The shared access signature for the source storage account.

--source-share

The source share files are copied from.

--source-uri

A URI that specifies a the source file share or blob container.

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