Jaa


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.

Request

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
https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=pagelist

https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=pagelist&snapshot=<DateTime>

https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=pagelist&snapshot=<DateTime>&prevsnapshot=<DateTime>
HTTP/1.1

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
http://127.0.0.1:10000/devstoreaccount1/mycontainer/myblob?comp=pagelist HTTP/1.1

For more information, see Use the Azure Storage Emulator for development and testing.

URI parameters

The following additional parameters may be specified on the request URI:

Parameter Description
marker 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.
maxresults 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.

Setting maxresults to a value that's less than or equal to zero results in error response code 400 (Bad Request).
snapshot 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.
timeout Optional. Expressed in seconds. For more information, see Set timeouts for Blob Storage operations.
prevsnapshot 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 prevsnapshot is the older of the two.

Note: Incremental snapshots are currently supported only for blobs that were created on or after January 1, 2016.

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, 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.
Range Optional. Specifies the range of bytes over which to list ranges, inclusively. If Range is omitted, all ranges for the blob are returned.
x-ms-range Optional. Specifies the range of bytes over which to list ranges, inclusively. If both Range and x-ms-range are specified, the service uses the value of x-ms-range. See Specify the range header for Blob Storage operations for more information.
x-ms-lease-id:<ID> 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).
x-ms-previous-snapshot-url Optional, version 2019-07-07 and later. The previous-snapshot-url specifies that the response will contain only pages that were changed between the target blob and snapshot that are located at the specified URI. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by this header is the older of the two.

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 prevsnapshot parameter.
x-ms-client-request-id 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.

Request body

None.

Response

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

Status code

A successful operation returns status code 200 (OK).

For more information about status codes, see Status and error codes.

Response headers

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.

Syntax Description
Last-Modified 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.
ETag 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.
x-ms-blob-content-length The size of the blob in bytes.
x-ms-request-id Uniquely identifies the request that was made, and it can be used to troubleshoot the request. For more information, see Troubleshoot API operations.
x-ms-version 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.
Date A UTC date/time value that's generated by the service, which indicates the time when the response was initiated.
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 and the value contains no more than 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

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.

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

If the 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

Authorization is required when calling any data access operation in Azure Storage. You can authorize the Get Page Ranges operation as described below.

Important

Microsoft recommends using Microsoft Entra ID with managed identities to authorize requests to Azure Storage. Microsoft Entra ID provides superior security and ease of use compared to Shared Key authorization.

Azure Storage supports using Microsoft Entra ID to authorize requests to blob data. With Microsoft Entra ID, 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 Microsoft Entra ID 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 Microsoft Entra ID, see Authorize access to blobs using Microsoft Entra ID.

Permissions

Listed below are the RBAC action necessary for a Microsoft Entra user, group, managed identity, or service principal to call the Get Page Ranges operation, and the least privileged built-in Azure RBAC role that includes this action:

To learn more about assigning roles using Azure RBAC, see Assign an Azure role for access to blob data.

Remarks

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.

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

Note

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

See also

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