Self-restore Deleted APIM Service
Published Dec 08 2020 07:49 PM 7,709 Views

In November 2020, we released a new feature that allows Users to restore the accidentally deleted API Management service using the corresponding REST APIs. Users shall use these new APIs to restore an accidentally deleted service only if the API Management service has been deleted with REST API version 2020-06-01-preview or higher. Reference document: Azure API Management soft-delete (preview) | Microsoft Docs


Currently if user deletes their API Management service from Azure Portal under "All Resources" page or if they delete the Resource Group where API Management service exists, Azure Resource Manager will send a DELETE request to API Management service with API version 2020-06-01-preview. In this case, the service will be placed in a "soft deleted" state.  We are planning to make all the “delete API Management” operation consistent with API version 2020-06-01-preview throughout Azure portal soon.


Purge API Management Service at “soft deleted” state


If you accidentally delete the API Management Service with the API version before 2020-06-01-preview, the deleted API Management service name will be immediately release and you will be able to re-create a new service with same name. if you want to restore the services, please contact support.


If the API Management service was deleted with API version 2020-06-01-preview or higher, then the API Management service will be left in a “soft deleted” state and you will be able to restore the service yourself. However, you cannot create an APIM with the same name immediately, if you want to create a new APIM service with same name, you can purge the “soft deleted” state APIM, please note that we cannot undelete a purged API Management service.


Please see examples below and I will use my APIM “jiaapim-testdelete” as an example.


Purge the APIM by using API: Deleted Services - Purge (Azure API Management) | Microsoft Docs




The response will return the deleted service name and the date that the APIM service was purged. 




Prerequisites of restore APIM


Please see examples below and I will use my APIM “jiaapim-external” as an example.


A deleted API Management service can be restored by yourself ONLY if the following conditions are TRUE:


  1. The API Management service was deleted with API version 2020-06-01-preview or higher and currently in a "soft deleted" state. When the API Management service is deleted, we keep the service in a "soft deleted" state for 2 days. This is subject to change without notice.





  1. The resource group where the original service resided at the time of being deleted still exists in your subscription. If you had deleted the resource group, you must re-create it with the same name for the restore operation to be successful.


Please note that we CANNOT:


  1. Restore a service that has been permanently deleted (the service is no longer in "soft deleted" state)
  1. Restore only certain entities of a given service. For example, if a user accidentally deletes an API or Operation from a service, we cannot restore those entities. We can only restore a deleted service.
  1. Rename the service upon or during restore, move it to a different resource group or a subscription. The service will always be restored with the same name, to the same resource group and in the same subscription.


Restore APIM services


After going the prerequisites of restoring APIM above, then let’s see how to restore an API Management service at “soft deleted” state. You can simply use this API Api Management Service - Create Or Update - REST API (Azure API Management) | Microsoft Docs The request URL should contain the original APIM service name, resource group name. The request body should contain the retore property and set it to true


Example of request body shown below:

    "properties": {
    "sku": {
    "location""australia east"



Response payload returned means the API Management service is being restored. Please see example below:




Additional Considerations


The Public VIP (I.P. Address) of the service will change after the restore. If your backend service was configured to only allow traffic from certain I.P. addresses, you may have to change the configuration to allow the new I.P. address (I.P. address can be obtained from the "Overview" blade of the Azure Portal).




If the service was in an external/internal VNET and the VNET/subnet has also been deleted, the service will be restored as if it is not in a VNET (this operation may fail, retry will help). If you need to add this restored API Management service to a VNET, then you will need to create a new VNET and add the restored APIM service to the VNET.





Version history
Last update:
‎Nov 11 2021 05:24 PM
Updated by: