Jaa


Snapshot Share

Beginning with version 2017-04-17, the Snapshot Share operation creates a read-only snapshot of a share.

Protocol availability

Enabled file share protocol Available Status
SMB Yes GA
NFS Yes GA

Request

You can construct the Snapshot Share request as follows. HTTPS is recommended.

Method Request URI HTTP version
PUT https://myaccount.file.core.windows.net/myshare?restype=share&comp=snapshot HTTP/1.1

Replace the path components shown in the request URI with your own, as follows:

Path component Description
myaccount The name of your storage account.
myshare The name of your file share.

For details on path naming restrictions, see Naming and referencing shares, directories, files, and metadata.

URI parameters

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

Parameter Description
timeout Optional. The timeout parameter is expressed in seconds. For more information, see Setting timeouts for Azure Files 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) time for the request. For more information, see Authorize requests to Azure Storage.
x-ms-version Required for all authorized requests. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage services.
x-ms-meta-name:value Optional. Specifies a user-defined, name-value pair, associated with the share snapshot. If you don't specify any name-value pairs, the operation copies the base share metadata to the snapshot.
If you specify one or more name-value pairs, the share snapshot is created with the specified metadata. In this case, metadata isn't copied from the base share.
Metadata names must adhere to the naming rules for C# identifiers.
x-ms-client-request-id Optional. Provides a client-generated, opaque value with a 1 kibibyte (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.

Sample request

Request Syntax:  
PUT https://myaccount.file.core.windows.net/myshare?restype=share&comp=snapshot HTTP/1.1

Request Headers:
x-ms-version: 2017-04-17
x-ms-date: Mon, 10 May 2017 22:50:32 GMT
x-ms-meta-Name: StorageSample
Authorization: SharedKey myaccount:Z5043vY9MesKNh0PNtksNc9nbXSSqGHueE00JdjidOQ=

Response

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

Status code

A successful operation returns status code 201 (Created). 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.

Response header Description
ETag Contains a value that represents the version of the share snapshot, in quotes.

A share snapshot can't be modified, so the ETag of a particular share snapshot never changes. However, if you supplied new metadata with the Snapshot Share request, then the ETag of the share snapshot differs from that of the base share. If you didn't specify any metadata with the request, the ETag of the share snapshot is identical to that of the base share, at the time the share snapshot was taken.
Last-Modified Returns the date and time the share was last modified. For more information, see Representation of date-time values in headers.

A share snapshot can't be modified, so the last modified time of a particular share snapshot never changes. However, if you supplied new metadata with the Snapshot Share request, then the last modified time of the share snapshot differs from that of the base share. If you didn't specify any metadata with the request, the last modified time of the share snapshot is identical to that of the base share, at the time the share snapshot was taken.
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 Azure Files used to run the request.
Date or x-ms-date A UTC date/time value that indicates the time at which the response was initiated. The service generates this value.
x-ms-snapshot A DateTime value that uniquely identifies the share snapshot. You can use the value of this header in subsequent requests to access the share snapshot. This value is opaque.
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

Response Status:
HTTP/1.1 201 Created

Response Headers:
Content-Length: 0
Date: Mon, 10 May 2017 23:00:12 GMT
ETag: "0x8CB14C3E29B7E82"
Last-Modified: Mon, 10 May 2017 23:00:06 GMT
x-ms-version: 2017-04-17
x-ms-snapshot: 2017-05-10T17:52:33.9551861Z
Server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0

Authorization

Only the account owner can call this operation.

Remarks

Share snapshots provide read-only versions of shares. After you create a share snapshot, you can't modify it. A share snapshot provides a convenient way to create a consistent backup of all files on a share.

Each time you call the Snapshot Share operation, a new share snapshot is created, with a unique DateTime value that identifies the share snapshot relative to its base share. You can use this DateTime value to perform further operations on the share snapshot and its contents. You should treat this DateTime value as opaque.

The DateTime value identifies the share snapshot on the request URI. For example, a file on the base share and its snapshots have URIs similar to the following examples:

  • File on the share: http://myaccount.file.core.windows.net/myshare/myfile
  • File on the share snapshot: http://myaccount.file.core.windows.net/myshare/myfile?sharesnapshot=<DateTime>

A share can support the creation of 200 share snapshots. If you attempt to create more than 200 share snapshots, the service returns error code 409 (Conflict). If you attempt to create a share snapshot while a previous Snapshot Share operation is in progress, the service also returns error code 409 (Conflict).

Existing share snapshots are never overwritten. They must be deleted explicitly. To explicitly delete share snapshots, call Delete Share and set the x-ms-include-snapshots header, along with the sharesnapshot query parameter, to the appropriate value.

You can view NFS share snapshots on an NFS client using snapshot virtual directory (.snapshot), which is typically located at the root of the share mount point. Access to this directory can be disabled by setting the x-ms-enable-snapshot-virtual-directory-access header to false in the Set Share Properties API. You can also set this header at the time of share creation as part of the Create Share operation.