Restore Share

The Restore Share operation restores (or undeletes) a share that had previously been soft-deleted. This API is fully supported, but it's a legacy management API. Instead, use File Shares - Restore, provided by the storage resource provider (Microsoft.Storage). To learn more about programmatically interacting with FileShare resources by using the storage resource provider, see Operations on FileShares.

The share is restored along with all of its data, metadata, and snapshots. The share resource includes metadata and properties for the share.

Protocol availability

Enabled file share protocol Available
SMB Yes
NFS No

Request

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

Method Request URI HTTP version
PUT https://myaccount.file.core.windows.net/restoredShareName?restype=share&comp=undelete 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.
restoredShareName The name to use for the restored share. If a share already exists with this name, the operation fails.

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 the required and optional request headers.

Request header Description
Authorization Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication for the Azure Storage services.
x-ms-date Required. Specifies the Coordinated Universal Time (UTC) time for the request. For more information, see Authentication for the Azure Storage services.
x-ms-version Required for all authenticated requests. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage services.
x-ms-deleted-share-name Required. Identifies the soft-deleted file share to be restored. This value must match the value of restoredShareName.
x-ms-deleted-share-version Required. Uniquely identifies the soft-deleted file share by its version.
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

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

Request Headers:  
x-ms-version: 2019-12-12   
x-ms-deleted-share-name: myshare 
x-ms-deleted-share-version: 01D2AC0C18EDFE36   
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). If the destination file share name is used by a valid non-deleted file share, the request will fail with a 409 (Conflict). If the source file share is not soft-deleted, has already been restored, or if the source file share has passed its retention period and has expired, the request will fail with a 404 (Not Found).

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, in quotes.
Last-Modified Returns the date and time the share was last modified. For more information, see Representation of date-time Values in headers.

Any operation that modifies the share, or its properties or metadata, updates the last modified time. Operations on files don't affect the last modified time of the share.
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 A UTC date/time value that indicates the time at which the response was initiated. The service generates this value.
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:  
x-ms-request-id: 78c46801-f01a-0089-31fb-486017000000 
x-ms-version: 2019-12-12   
Content-Length: 0 
Date: <date>   
ETag: "0x8CB14C3E29B7E82"   
Last-Modified: <date>   
Server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 

Authorization

The storage account owner can call this operation. Additionally, users with valid account shared access signature tokens can call this operation. The token must include write permissions for the container resource to authorize this operation.

Remarks

You can't restore a share to a different name. When you restore a share, if another share exists with the same name, the operation fails with status code 409 (Conflict). The share with the same name must first be deleted, before the soft-deleted share can be undeleted.

When a share is deleted, a share with the same name can't be restored for at least 30 seconds. While the share is being deleted, attempts to restore a share of the same name fail with status code 409 (Conflict). The service returns additional error information, indicating that the share is being deleted.

See also

Operations on shares (Azure Files)