Incremental Copy Blob

The Incremental Copy Blob operation copies a snapshot of the source page blob to a destination page blob. Only the differences from the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot, and you can read or copy from them as usual. This API is supported since REST version 2016-05-31.

Request

You can construct the Incremental Copy Blob request as follows. HTTPS is recommended. Replace myaccount with the name of your storage account, mycontainer with the name of your container, and myblob with the name of your destination blob. The comp query parameter, with value of incrementalcopy, indicates that this request is to create an incremental snapshot.

PUT method request URI HTTP version
https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=incrementalcopy HTTP/1.1

Emulated storage service URI

When you make a request against the emulated storage service, specify the emulator hostname and Azure Blob Storage service port as 127.0.0.1:10000, followed by the emulated storage account name. Also indicate that this request is for incremental copy, by setting the comp query parameter to incrementalcopy.

PUT method request URI HTTP version
http://127.0.0.1:10000/devstoreaccount1/mycontainer/myblob?comp=incrementalcopy HTTP/1.1

For more information, see Use Azurite emulator for local Azure Storage development.

URI parameters

You can specify the following additional parameters on the request URI.

Parameter Description
timeout Optional. The timeout parameter is expressed in seconds. For more information, see Setting timeouts for Blob Storage operations.

Request headers

The following table describes required and optional request headers.

Request header Description
Authorization Required. Specifies the authorization scheme, account name, and signature. For more information, see Authorize requests to Azure Storage.
Date or x-ms-date Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authorize requests to Azure Storage.
x-ms-version Required for all authorized requests, and optional for anonymous requests. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage services.
If-Modified-Since Optional. A DateTime value. 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 hasn't been modified, Blob Storage returns status code 412 (Precondition Failed).
If-Unmodified-Since Optional. A DateTime value. Specify this conditional header to copy the blob only if the destination blob hasn't been modified since the specified date/time. If the destination blob has been modified, Blob Storage returns status code 412 (Precondition Failed).
If-Match Optional. An ETag value. Specify an ETag value for this conditional header to copy the blob, only if the specified ETag value matches the ETag value for an existing destination blob. If the ETag for the destination blob doesn't match the ETag specified for If-Match, Blob Storage returns status code 412 (Precondition Failed).
If-None-Match Optional. An ETag value, or the wildcard character (*).

Specify an ETag value for this conditional header to copy the blob, only if the specified ETag value doesn't match the ETag value for the destination blob.

Specify the wildcard character (*) to perform the operation, only if the destination blob doesn't exist.

If the specified condition isn't met, Blob Storage returns status code 412 (Precondition Failed).
x-ms-copy-source:name Required. Specifies the name of the source page blob snapshot.

This value is a URL of up to 2 kibibytes (KiB) in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob URI can be authorized in one of two ways:

The source blob URI can reference a page blob snapshot, but it must include a shared access signature (SAS) token that was created on the snapshot's base blob. The signed resource (sr) field of the SAS should be set to b. For example: https://<account-name>.blob.core.windows.net/<container-name>/<page-blob-name>?snapshot=2022-07-23T00:14:45.3964054Z&sp=r&st=2022-07-23T00:15:38Z&se=2022-07-23T08:15:38Z&spr=https&sv=2021-06-08&sr=b&sig=<signature>.

The source blob URI can reference a public page blob snapshot; for example, https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot=<DateTime>.
x-ms-client-request-id Optional. Provides a client-generated, opaque value with a 1-KiB character limit that's recorded in the logs when logging is configured. We highly recommend that you use this header to correlate client-side activities with requests that the server receives. For more information, see Monitor Azure Blob Storage.

Request body

None.

Response

The response includes an HTTP status code, and a set of response headers.

Status code

A successful operation returns status code 202 (Accepted). For information about status codes, see Status and error codes.

Response headers

The response for this operation includes the following headers. The response can also include additional, standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Syntax Description
ETag Contains a value that you can use to perform operations conditionally. The value is in quotes.
Last-Modified The date and time that the blob was last modified. For more information, see Representation of date/time values in headers.

Any write operation on the blob (including updates on the blob's metadata or properties) changes the last-modified time of the blob.
x-ms-request-id Uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API operations.
x-ms-version Indicates the version of Blob Storage used to run the request.
Date A UTC date/time value that indicates the time at which the response was initiated. The service generates this value.
x-ms-copy-id: <id> The string identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to stop a pending copy.
x-ms-copy-status: pending The state of the copy operation. This is always pending, to indicate that the copy has started and is in progress.
x-ms-client-request-id Can be used to troubleshoot requests and corresponding responses. The value of this header is equal to the value of the x-ms-client-request-id header, if it's present in the request. The value is at most 1,024 visible ASCII characters. If the x-ms-client-request-id header isn't present in the request, it won't be present in the response.

Response body

None.

Sample response

The following is a sample response for a request to perform an incremental copy:

Response Status:
HTTP/1.1 202 Accepted

Response Headers: 
Last-Modified: <date> 
ETag: "0x8CEB669D794AFE2"
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: cc6b209a-b593-4be1-a38a-dde7c106f402
x-ms-version: 2016-05-31
x-ms-copy-id: 1f812371-a41d-49e6-b123-f4b542e851c5
x-ms-copy-status: pending
Date: <date> 

Authorization

The destination account owner can call this operation. Additionally, a shared access signature of the destination blob can call this operation.

Access to the source blob or file is authorized separately, as described in the details for the request header, x-ms-copy-source.

Remarks

The destination of an incremental copy must either not exist, or must have been created with a previous incremental copy from the same source blob. After you create it, the destination blob is permanently associated with the source, and can only be used for incremental copies. The Get Blob Properties and List Blobs APIs indicate whether the blob is an incremental copy blob created in this way.

You can't directly download incremental copy blobs. The only supported operations are Get Blob Properties, Incremental Copy Blob, and Delete Blob. You can read and delete the copied snapshots as usual.

You perform an incremental copy asynchronously on the service, and you must poll for completion. Refer to the Copy Blob API for details on how to poll a pending copy. When the copy completes, the destination blob will contain a new snapshot. The Get Blob Properties API returns the snapshot time of the newly created snapshot.

The first time you perform an incremental copy on a destination blob, a new blob is created, with a snapshot that is fully copied from the source. Each subsequent call to Incremental Copy Blob creates a new snapshot, by copying only the differential changes from the previously copied snapshot.

The differential changes are computed on the server by issuing a Get Page Ranges call on the source blob snapshot. Set prevsnapshot to the most recently copied snapshot. Therefore, the same restrictions on Get Page Ranges apply to Incremental Copy Blob. Specifically, you must copy snapshots in ascending order, and if the source blob is re-created by using Put Blob or Copy Blob, then Incremental Copy Blob on new snapshots will fail.

The additional storage space consumed by the copied snapshot is the size of the differential data transferred during the copy. You can determine this size by performing a differential Get Page Ranges API call on the snapshot, to compare it to the previous snapshot.

See also

Authorize requests to Azure Storage
Status and error codes
Setting timeouts for Blob Storage operations