Restore Container
The Restore Container
operation restores the contents and properties of a soft-deleted container to a specified container. The Restore Container
operation is available on version 2019-12-12
and later.
Request
You can construct the Restore Container
request by using a valid request, authorized by using shared key, account shared access signature authorization, or role-based access control.
Method | Request URI | HTTP version |
---|---|---|
PUT |
https://myaccount.blob.core.windows.net/destinationcontainer?restype=container&comp=undelete |
HTTP/1.1 |
PUT |
https://myaccount.blob.core.windows.net/destinationcontainer?restype=container&comp=undelete&sv=validsastoken |
HTTP/1.1 |
URI parameters
You can specify the following additional parameters on the request URI.
Parameter | Description |
---|---|
restype |
Required. The restype parameter value must be container . |
comp |
Required. The comp parameter value must be undelete . |
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. Specifies the version of the operation to use for this request. For this operation, the version must be 2018-03-28 or later. For more information, see Versioning for the Azure Storage services. |
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. |
x-ms-deleted-container-name |
Required. You use this header to uniquely identify the soft-deleted container that should be restored. |
x-ms-deleted-container-version |
Required. You use this header to uniquely identify the soft-deleted container that should be restored. You can obtain this value from specifying the deleted value in the include query parameter of the List Containers operation. For more information, see List Containers. |
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 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 |
---|---|
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 |
Version 2009-09-19 and later. Indicates the version of Azure 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. |
Content-Length |
The length of the request body. For this operation, the content length is always zero. |
Response body
None.
Sample response
Response Status:
HTTP/1.1 201 OK
Response Headers:
Date: Mon, 15 Jun 2020 12:43:08 GMT
x-ms-version: 2019-12-12
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Content-Length: 0
Authorization
Authorization is required when you're calling any data access operation in Azure Storage. You can authorize the Restore Container
operation as described in the following sections.
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 can 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 Blob Storage.
To learn more about authorization by using Microsoft Entra ID, see Authorize access to blobs using Microsoft Entra ID.
Permissions
The following RBAC actions are necessary for a Microsoft Entra user, group, managed identity, or service principal to call the Restore Container
operation, and the least privileged built-in Azure RBAC role that includes this action:
- Azure RBAC action: Microsoft.Storage/storageAccounts/blobServices/containers/write
- Least privileged built-in role: Storage Blob Data Contributor
To learn more about assigning roles by using Azure RBAC, see Assign an Azure role for access to blob data.
Remarks
- You can set the container delete retention policy on the account by using the Storage Resource Provider.
- The specified container must not exist at the time that the
Restore Container
operation is performed. - If the specified container exists, the
Restore Container
operation will fail with a 409 (Conflict). - If the soft-deleted container does not exist, has already been used as the source of a
Restore Container
operation, or has exceeded its retention days, the operation will fail with a 409 (Conflict).
Billing
Pricing requests can originate from clients that use Blob Storage APIs, either directly through the Blob Storage REST API, or from an Azure Storage client library. These requests accrue charges per transaction. The type of transaction affects how the account is charged. For example, read transactions accrue to a different billing category than write transactions. The following table shows the billing category for Restore Container
requests based on the storage account type:
Operation | Storage account type | Billing category |
---|---|---|
Restore Container | Premium block blob Standard general-purpose v2 Standard general-purpose v1 |
List and Create Container operations |
To learn about pricing for the specified billing category, see Azure Blob Storage Pricing.