Search code examples
azureazure-api-managementsoft-delete

How do I disable soft delete of an Azure API Management instance when deploying using an ARM template?


In my project team we have an Azure DevOps pipeline that tears down a particular resource group in our CI environment, and then the next day it redeploys it using an ARM template.

In ~Spring 2021 it seems the soft delete option was auto-enabled on Azure API Management instances, and so now this pipeline is failing. This is because you can't deploy a resource of the same name as one that has been soft deleted, and these aren't automatically purged until 48 hours after deletion. As the pipeline tries to redeploy the API Management instance within this timeframe, it fails. The time between tear down and redeployment cannot be extended.

There's this documentation for API Management, but that's for REST API calls, and I want to know if it can be specified in the ARM template deployment.

There's also this documentation for a keyvault resource, perhaps I can use something similar? I'm not sure where I'd put it, however.

Any relevant advice welcome. TIA.


Solution

  • Please refer to https://learn.microsoft.com/en-us/answers/questions/257072/azure-api-management-already-exists.html and see if this helps. You may want to raise a feature request on UserVoice to support.

    You may try to create a script to check “List deleted services by subscription” REST API to check if the deleted APIM services are in "soft deleted" state, it will also returned the date when the API Management service is going to be purged. Deleted Services - List By Subscription (Azure API Management) | Microsoft Docs