Get Page Ranges
The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob.
The Get Page Ranges request may be constructed as follows. We recommend that you use HTTPS. Replace myaccount with the name of your storage account:
|GET method request URI||HTTP version|
Emulated storage service URI
When you're making a request against the emulated storage service, specify the emulator hostname and Azure Blob Storage port as 127.0.0.1:10000, followed by the emulated storage account name:
|GET method request URI||HTTP version|
For more information, see Use the Azure Storage Emulator for development and testing.
The following additional parameters may be specified on the request URI:
||Optional, version 2020-10-02 and later. Identifies the portion of the ranges to be returned with the next GetPageRanges operation. The operation returns a marker value within the response body if the returned ranges were incomplete. The marker value can then be used in a subsequent call to request the next set of ranges.
The marker value is opaque to the client.
||Optional, version 2020-10-02 and later. Specifies the maximum number of page ranges to return. If the request specifies a value that's greater than 10,000, the server returns up to 10,000 items. If there are additional results to return, the service returns a continuation token in the NextMarker response element.
||Optional. An opaque DateTime value that, when present, specifies the blob snapshot to retrieve information from. For more information about working with blob snapshots, see Create a snapshot of a blob.|
||Optional. Expressed in seconds. For more information, see Set timeouts for Blob Storage operations.|
||Optional, version 2015-07-08 and later. A DateTime value that specifies that the response will contain only pages that were changed between the target blob and the previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by
Note: Incremental snapshots are currently supported only for blobs that were created on or after January 1, 2016.
The following table describes required and optional request headers.
||Required. Specifies the authorization scheme, account name, and signature. For more information, see Authorize requests to Azure Storage.|
||Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authorize requests to Azure Storage.|
||Required for all authorized requests, 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.|
||Optional. Specifies the range of bytes over which to list ranges, inclusively. If
||Optional. Specifies the range of bytes over which to list ranges, inclusively. If both
||Optional. If this header is specified, the operation is performed only if both of the following conditions are met:
- The blob's lease is currently active.
- The lease ID that's specified in the request matches the lease ID of the blob.
If this header is specified and either condition isn't met, the request fails and the operation fails with status code 412 (Precondition Failed).
||Optional, version 2019-07-07 and later. The
Note: Incremental snapshots are currently supported only for blobs that were created on or after January 1, 2016, and that this header should only be used in managed disk scenarios. Otherwise, use the
||Optional. Provides a client-generated, opaque value with a 1-kibibyte (KiB) character limit, which is recorded in the analytics logs when Azure Storage Analytics logging is enabled. We highly recommend that you use this header when you're correlating client-side activities with requests that are received by the server. For more information, see About Storage Analytics logging and Azure logging: Use logs to track Azure Storage requests.|
This operation also supports the use of conditional headers to get page ranges only if a specified condition is met. For more information, see Specify conditional headers for Blob Storage operations.
The response includes an HTTP status code, a set of response headers, and the response body.
A successful operation returns status code 200 (OK).
For more information about status codes, see Status and error codes.
The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
||The date/time that the blob was last modified. The date format follows RFC 1123.
Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the blob's last modified time.
||Contains a value that the client can use to perform the operation conditionally. If the request version is 2011-08-18 or later, the ETag value is enclosed in quotation marks.|
||The size of the blob in bytes.|
||Uniquely identifies the request that was made, and it can be used to troubleshoot the request. For more information, see Troubleshoot API operations.|
||Indicates the Blob Storage version that was used to execute the request. This header is returned for requests that were made against version 2009-09-19 and later.
This header is also returned for anonymous requests without a specified version if the container was marked for public access by using Blob Storage version 2009-09-19.
||A UTC date/time value that's generated by the service, which indicates the time when the response was initiated.|
||Can be used to troubleshoot requests and corresponding responses. The value of this header is equal to the value of the
The response body includes a list of non-overlapping, valid page ranges, sorted by increasing address page range. The format of the response body is as follows:
<?xml version="1.0" encoding="utf-8"?> <PageList> <PageRange> <Start>Start Byte</Start> <End>End Byte</End> </PageRange> <PageRange> <Start>Start Byte</Start> <End>End Byte</End> </PageRange> </PageList>
If the blob's entire set of pages has been cleared, the response body doesn't include any page ranges.
prevsnapshot parameter was specified, the response includes only the pages that differ between the target snapshot or blob and the previous snapshot. The returned pages include both pages that were updated or cleared. The format of this response body is as follows:
<?xml version="1.0" encoding="utf-8"?> <PageList> <PageRange> <Start>Start Byte</Start> <End>End Byte</End> </PageRange> <ClearRange> <Start>Start Byte</Start> <End>End Byte</End> </ClearRange> <PageRange> <Start>Start Byte</Start> <End>End Byte</End> </PageRange> </PageList>
If the blob's entire set of pages has been cleared and the
prevsnapshot parameter wasn't specified, the response body doesn't include any page ranges.
maxresults parameter was specified, the response includes only the specified number of ranges with a continuation token in the
NextMarker tag. The continuation token is empty if there are no more pending ranges, or else it contains an opaque value that needs to be sent as a
marker parameter in the next request. The format of this response body is as follows:
<?xml version="1.0" encoding="utf-8"?> <PageList> <PageRange> <Start>Start Byte</Start> <End>End Byte</End> </PageRange> <ClearRange> <Start>Start Byte</Start> <End>End Byte</End> </ClearRange> <PageRange> <Start>Start Byte</Start> <End>End Byte</End> </PageRange> <NextMarker/> </PageList>
Authorization is required when calling any data access operation in Azure Storage. You can authorize the
Get Page Ranges operation as described below.
Azure Storage supports using Azure Active Directory (Azure AD) to authorize requests to blob data. With Azure AD, you can use Azure role-based access control (Azure RBAC) to grant permissions to a security principal. The security principal may be a user, group, application service principal, or Azure managed identity. The security principal is authenticated by Azure AD to return an OAuth 2.0 token. The token can then be used to authorize a request against the Blob service.
To learn more about authorization using Azure AD, see Authorize access to blobs using Azure Active Directory.
Listed below are the RBAC action necessary for an Azure AD user, group, or service principal to call the
Get Page Ranges operation, and the least privileged built-in Azure RBAC role that includes this action:
- Azure RBAC action: Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read
- Least privileged built-in role: Storage Blob Data Reader
To learn more about assigning roles using Azure RBAC, see Assign an Azure role for access to blob data.
The start and end byte offsets for each page range are inclusive.
In a highly fragmented page blob with a large number of writes, a
Get Page Ranges request can fail due to an internal server timeout. Applications retrieving ranges of a page blob with a large number of write operations should retrieve a subset of page ranges at a time.
As of version 2015-07-08, you can call
Get Page Ranges with the
prevsnapshot parameter to return the pages that differ between the base blob and a snapshot, or between two snapshots of the blob. By using these page differences, you can save an incremental snapshot of a page blob. Incremental snapshots are a cost-effective way to back up virtual machine disks if you want to implement your own backup solution.
Get Page Ranges with the
prevsnapshot parameter returns pages that have been updated or cleared since the snapshot that's specified by
prevsnapshot was taken. You can then copy the pages that are returned to a backup page blob in another storage account by using Put Page.
As of version 2019-07-07, you can use the
x-ms-previous-snapshot-url header to specify snapshots in managed disk accounts for incremental snapshots. If you're not using managed disks, use the
prevsnapshot query parameter.
Certain operations on a blob cause
Get Page Ranges to fail when it's called to return an incremental snapshot.
Get Pages Ranges fails with error code 409 (Conflict) if it's called on a blob that was the target of a Put Blob or Copy Blob request after the snapshot specified by
prevsnapshot was taken. If the target of the
Get Page Ranges operation is itself a snapshot, the call succeeds as long as the snapshot that's specified by
prevsnapshot is older, and no
Put Blob or
Copy Blob operation was called in the interval between the two snapshots.
Incremental snapshots are currently supported only for blobs that were created on or after January 1, 2016. Attempts to use this feature on an older blob will result in the
BlobOverwritten error, which is HTTP error code 409 (Conflict).
Authorize requests to Azure Storage
Status and error codes
Set timeouts for Blob Storage operations