title | description | ms.service | ms.topic | author | ms.author | ms.date |
---|---|---|---|---|---|---|
Azure API Management soft-delete (preview) | Microsoft Docs |
Soft-delete allows you to recover a recently deleted API Management instance. |
api-management |
conceptual |
dlepow |
danlep |
02/07/2022 |
With API Management soft-delete, you can recover and restore a recently deleted API Management instance. This feature protects against accidental deletion of your API Management instance.
Currently, depending on how you delete an API Management instance, the instance is either soft-deleted and recoverable during a retention period, or it's permanently deleted:
- When you use the Azure portal or REST API version
2020-06-01-preview
or later to delete an API Management instance, it's soft-deleted. - An API Management instance deleted using a REST API version before
2020-06-01-preview
is permanently deleted. - An API Management instance deleted using API Management commands in Azure PowerShell or Azure CLI is permanently deleted.
Recovery and other operations on a soft-deleted instance are enabled through REST API version 2020-06-01-preview
or later, or the Azure SDK for .NET, Go, or Python.
Tip
Refer to Azure REST API Reference for tips and tools for calling Azure REST APIs and API Management REST for additional information specific to API Management.
Operation | Description | API Management namespace | Minimum API version |
---|---|---|---|
Create or Update | Creates or updates an API Management service. | API Management Service | Any |
Create or Update with restore property set to true |
Recovers (undeletes) an API Management Service if it was previously soft-deleted. If restore is specified and set to true all other properties will be ignored. |
API Management Service | 2020-06-01-preview |
Delete | Deletes an existing API Management service. | API Management Service | 2020-06-01-preview |
Get By Name | Get soft-deleted Api Management Service by name. | Deleted Services | 2020-06-01-preview |
List By Subscription | Lists all soft-deleted services available for undelete for the given subscription. | Deleted Services | 2020-06-01-preview |
Purge | Purges API Management Service (permanently deletes it with no option to undelete). | Deleted Services | 2020-06-01-preview |
You can use any API version to create your API Management instance. When you use the Azure portal, Azure REST API, or another Azure tool using API version 2020-06-01-preview
or later to delete an API Management instance, it's automatically soft-deleted.
Upon soft-deleting an API Management instance, the service will exist in a deleted state, making it inaccessible to normal API Management operations.
In the soft-deleted state:
- The API Management instance can only be listed, recovered, or purged (permanently deleted).
- Azure will schedule the permanent deletion of the underlying data corresponding to the API Management instance after the predetermined (48 hour) retention period.
- You can't reuse the name of the API Management instance.
If your API Management instance isn't recovered or purged by you within 48 hours, it's automatically deleted permanently.
You can verify that a soft-deleted API Management instance is available to restore (undelete) using either the Deleted Services Get By Name or List By Subscription operations.
Use the API Management Get By Name operation, substituting {subscriptionId}
, {location}
, and {serviceName}
with your Azure subscription, resource location, and API Management instance name:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}?api-version=2021-08-01
If available for undelete, Azure will return a record of the APIM instance showing its deletionDate
and scheduledPurgeDate
, for example:
{
"id": "subscriptions/########-####-####-####-############/providers/Microsoft.ApiManagement/locations/southcentralus/deletedservices/apimtest",
"name": "apimtest",
"type": "Microsoft.ApiManagement/deletedservices",
"location": "South Central US",
"properties": {
"serviceId": "/subscriptions/########-####-####-####-############/resourceGroups/apimtestgroup/providers/Microsoft.ApiManagement/service/apimtest",
"scheduledPurgeDate": "2021-11-26T19:40:26.3596893Z",
"deletionDate": "2021-11-24T19:40:50.1013572Z"
}
}
Use the API Management List By Subscription operation, substituting {subscriptionId}
with your subscription ID:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices?api-version=2021-08-01
This will return a list all soft-deleted services available for undelete under the given subscription, showing the deletionDate
and scheduledPurgeDate
for each.
Use the API Management Create Or Update operation, substituting {subscriptionId}
, {resourceGroup}
, and {apimServiceName}
with your Azure subscription, resource group name, and API Management name:
PUT
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.ApiManagement/service/{apimServiceName}?api-version=2021-08-01
. . . and set the restore
property to true
in the request body. (When this flag is specified and set to true, all other properties will be ignored.) For example:
{
"properties": {
"publisherEmail": "help@contoso.com",
"publisherName": "Contoso",
"restore": true
},
"sku": {
"name": "Developer",
"capacity": 1
},
"location": "South Central US"
}
Use the API Management Purge operation, substituting {subscriptionId}
, {location}
, and {serviceName}
with your Azure subscription, resource location, and API Management name:
DELETE https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}?api-version=2021-08-01
This will permanently delete your API Management instance from Azure.
Learn about long-term API Management backup and recovery options: