Dijeli putem


az storage blob copy

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 blob copy operations. Use az storage blob show to check the status of the blobs.

Commands

Name Description Type Status
az storage blob copy cancel

Abort an ongoing copy operation.

Core GA
az storage blob copy start

Copy a blob asynchronously. Use az storage blob show to check the status of the blobs.

Core GA
az storage blob copy start (storage-blob-preview extension)

Start a copy blob job.

Extension GA
az storage blob copy start-batch

Copy multiple blobs to a blob container. Use az storage blob show to check the status of the blobs.

Core GA

az storage blob copy cancel

Abort an ongoing copy operation.

This will leave a destination blob with zero length and full metadata. This will raise an error if the copy operation has already ended.

az storage blob copy cancel --copy-id
                            --destination-blob
                            --destination-container
                            [--account-key]
                            [--account-name]
                            [--auth-mode {key, login}]
                            [--blob-endpoint]
                            [--connection-string]
                            [--lease-id]
                            [--sas-token]
                            [--timeout]

Required Parameters

--copy-id

The copy operation to abort. This can be either an ID string, or an instance of BlobProperties.

--destination-blob -b

Name of the destination blob. If it exists, it will be overwritten.

--destination-container -c

The container 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
--blob-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.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--lease-id

Required if the destination blob has an active infinite lease.

--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 blob copy start

Copy a blob asynchronously. Use az storage blob show to check the status of the blobs.

az storage blob copy start --destination-blob
                           --destination-container
                           [--account-key]
                           [--account-name]
                           [--auth-mode {key, login}]
                           [--blob-endpoint]
                           [--connection-string]
                           [--destination-blob-type {AppendBlob, BlockBlob, Detect, PageBlob}]
                           [--destination-if-match]
                           [--destination-if-modified-since]
                           [--destination-if-none-match]
                           [--destination-if-unmodified-since]
                           [--destination-lease-id]
                           [--destination-tags-condition]
                           [--metadata]
                           [--rehydrate-priority]
                           [--requires-sync {false, true}]
                           [--sas-token]
                           [--source-account-key]
                           [--source-account-name]
                           [--source-blob]
                           [--source-container]
                           [--source-if-match]
                           [--source-if-modified-since]
                           [--source-if-none-match]
                           [--source-if-unmodified-since]
                           [--source-lease-id]
                           [--source-path]
                           [--source-sas]
                           [--source-share]
                           [--source-snapshot]
                           [--source-tags-condition]
                           [--source-uri]
                           [--tags]
                           [--tier]
                           [--timeout]

Examples

Copy a blob asynchronously. Use `az storage blob show` to check the status of the blobs.

az storage blob copy start --account-key 00000000 --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --source-uri https://storage.blob.core.windows.net/photos

Copy a blob asynchronously. Use `az storage blob show` to check the status of the blobs.

az storage blob copy start --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --sas-token $sas --source-uri https://storage.blob.core.windows.net/photos

Copy a blob specific version

az storage blob copy start --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --source-uri https://my-account.blob.core.windows.net/my-container/my-blob?versionId=2022-03-21T18:28:44.4431011Z --auth-mode login

Required Parameters

--destination-blob -b

Name of the destination blob. If it exists, it will be overwritten.

--destination-container -c

The container 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
--blob-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.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--destination-blob-type

Defines the type of blob at the destination. Value of "Detect" determines the type based on source blob type.

Accepted values: AppendBlob, BlockBlob, Detect, PageBlob
--destination-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.

--destination-if-modified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed).

--destination-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. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--destination-if-unmodified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has not been modified since the specified date/time. If the destination blob has been modified, the Blob service returns status code 412 (Precondition Failed).

--destination-lease-id

The lease ID specified for this header must match the lease ID of the estination blob. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed).

--destination-tags-condition

Specify a SQL where clause on blob tags to operate only on blobs with a matching value.

--metadata

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

--rehydrate-priority -r

Indicate the priority with which to rehydrate an archived blob.

--requires-sync

Enforce that the service will not return a response until the copy is complete.

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.

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

--source-if-modified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has been modified since the specified date/time.

--source-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. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--source-if-unmodified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has not been modified since the specified date/time.

--source-lease-id

Specify this to perform the Copy Blob operation only if the lease ID given matches the active lease ID of the source blob.

--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-tags-condition

Specify a SQL where clause on blob tags to operate only on blobs with a matching value.

--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.blob.core.windows.net/mycontainer/myblob, https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot=<DateTime>, https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--tier

The tier value to set the blob to. For page blob, the tier correlates to the size of the blob and number of allowed IOPS. Possible values are P10, P15, P20, P30, P4, P40, P50, P6, P60, P70, P80 and this is only applicable to page blobs on premium storage accounts; For block blob, possible values are Archive, Cold, Cool, and Hot. This is only applicable to block blobs on standard storage accounts.

--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 blob copy start (storage-blob-preview extension)

Start a copy blob job.

az storage blob copy start --destination-blob
                           --destination-container
                           [--account-key]
                           [--account-name]
                           [--auth-mode {key, login}]
                           [--blob-endpoint]
                           [--connection-string]
                           [--destination-blob-type {AppendBlob, BlockBlob, Detect, PageBlob}]
                           [--destination-if-match]
                           [--destination-if-modified-since]
                           [--destination-if-none-match]
                           [--destination-if-unmodified-since]
                           [--destination-lease-id]
                           [--destination-tags-condition]
                           [--metadata]
                           [--rehydrate-priority]
                           [--requires-sync {false, true}]
                           [--sas-token]
                           [--source-account-key]
                           [--source-account-name]
                           [--source-blob]
                           [--source-container]
                           [--source-if-match]
                           [--source-if-modified-since]
                           [--source-if-none-match]
                           [--source-if-unmodified-since]
                           [--source-lease-id]
                           [--source-path]
                           [--source-sas]
                           [--source-share]
                           [--source-snapshot]
                           [--source-tags-condition]
                           [--source-uri]
                           [--tags]
                           [--tier]
                           [--timeout]

Examples

Copy a blob asynchronously. Use `az storage blob show` to check the status of the blobs.

az storage blob copy start --account-key 00000000 --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --source-uri https://storage.blob.core.windows.net/photos

Copy a blob asynchronously. Use `az storage blob show` to check the status of the blobs.

az storage blob copy start --account-name MyAccount --destination-blob MyDestinationBlob --destination-container MyDestinationContainer --sas-token $sas --source-uri https://storage.blob.core.windows.net/photos

Required Parameters

--destination-blob -b

Name of the destination blob. If it exists, it will be overwritten.

--destination-container -c

The container 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
--blob-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.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--destination-blob-type

Defines the type of blob at the destination. Value of "Detect" determines the type based on source blob type.

Accepted values: AppendBlob, BlockBlob, Detect, PageBlob
--destination-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.

--destination-if-modified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed).

--destination-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. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--destination-if-unmodified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has not been modified since the specified date/time. If the destination blob has been modified, the Blob service returns status code 412 (Precondition Failed).

--destination-lease-id

The lease ID specified for this header must match the lease ID of the estination blob. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed).

--destination-tags-condition

Specify a SQL where clause on blob tags to operate only on blobs with a matching value.

--metadata

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

--rehydrate-priority -r

Indicate the priority with which to rehydrate an archived blob.

--requires-sync

Enforce that the service will not return a response until the copy is complete.

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.

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

--source-if-modified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has been modified since the specified date/time.

--source-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. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--source-if-unmodified-since

A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has not been modified since the specified date/time.

--source-lease-id

Specify this to perform the Copy Blob operation only if the lease ID given matches the active lease ID of the source blob.

--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-tags-condition

Specify a SQL where clause on blob tags to operate only on blobs with a matching value.

--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.blob.core.windows.net/mycontainer/myblob, https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot=<DateTime>, https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space ( ), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_).

--tier

The tier value to set the blob to. For page blob, the tier correlates to the size of the blob and number of allowed IOPS. Possible values are P10, P15, P20, P30, P4, P40, P50, P6, P60, P70, P80 and this is only applicable to page blobs on premium storage accounts; For block blob, possible values are Archive, Cold, Cool and Hot. This is only applicable to block blobs on standard storage accounts.

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

Copy multiple blobs to a blob container. Use az storage blob show to check the status of the blobs.

az storage blob copy start-batch [--account-key]
                                 [--account-name]
                                 [--auth-mode {key, login}]
                                 [--blob-endpoint]
                                 [--connection-string]
                                 [--destination-blob-type {AppendBlob, BlockBlob, Detect, PageBlob}]
                                 [--destination-container]
                                 [--destination-path]
                                 [--dryrun]
                                 [--pattern]
                                 [--rehydrate-priority]
                                 [--sas-token]
                                 [--source-account-key]
                                 [--source-account-name]
                                 [--source-container]
                                 [--source-sas]
                                 [--source-share]
                                 [--source-uri]
                                 [--tier]

Examples

Copy multiple blobs to a blob container. Use `az storage blob show` to check the status of the blobs. (autogenerated)

az storage blob copy start-batch --account-key 00000000 --account-name MyAccount --destination-container MyDestinationContainer --source-account-key MySourceKey --source-account-name MySourceAccount --source-container MySourceContainer

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

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--destination-blob-type

Defines the type of blob at the destination. Value of "Detect" determines the type based on source blob type.

Accepted values: AppendBlob, BlockBlob, Detect, PageBlob
--destination-container -c

The blob container where the selected source files or blobs will be copied to.

--destination-path

The destination path that will be prepended to the blob name.

--dryrun

List the files or blobs to be uploaded. No actual data transfer will occur.

Default value: False
--pattern

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

When you use '*' in --pattern, it will match any character including the the directory separator '/'.

--rehydrate-priority -r

Indicate the priority with which to rehydrate an archived blob.

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

--source-account-key

The account key for the source storage account.

--source-account-name

The source storage account from which the files or blobs are copied to the destination. If omitted, the destination account is used.

--source-container

The source container from which blobs are copied.

--source-sas

The shared access signature for the source storage account.

--source-share

The source share from which files are copied.

--source-uri

A URI specifying a file share or blob container from which the files or blobs are copied.

If the source is in another account, the source must either be public or be authenticated by using a shared access signature.

--tier

The tier value to set the blob to. For page blob, the tier correlates to the size of the blob and number of allowed IOPS. Possible values are P10, P15, P20, P30, P4, P40, P50, P6, P60, P70, P80 and this is only applicable to page blobs on premium storage accounts; For block blob, possible values are Archive, Cold, Cool, and Hot. This is only applicable to block blobs on standard storage accounts.

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.