Azure Management REST API Delete Certificate Does Not Delelete Despite Response Code 200

David Warwick 121 Reputation points
2022-01-30T00:21:47.96+00:00

All, I am trying to delete an App Managed Private Key Certificate using the Azure Management REST API. I am getting a 200 response code, but the certificate is still associated with my APP Service.

See https://learn.microsoft.com/en-us/rest/api/appservice/certificates/delete

private static async Task<HttpResponseMessage> DeleteHostNameCertificateAsync(string sHostName)  
{  
    using (var client = new HttpClient())  
    {  
        client.DefaultRequestHeaders.Add("Authorization", "Bearer " + GetAccessToken());  
        string requestURl = _baseURI + $"subscriptions/{_SubscriptionId}/resourceGroups/{_ResourceGroupName}/providers/Microsoft.Web/certificates/{sHostName}?api-version=2021-02-01";  
  
        return await client.DeleteAsync(requestURl);  
    }  
}  
  

I successfully delete the hostname binding for the App Custom Domain. This works perfectly. After the hostname binding has been deleted, I then try to delete the certificate. I get the 200 response, but the certificate remains.

private static async Task<HttpResponseMessage> DeleteHostNameBindingAsync(string sHostName)  
{  
    using (var client = new HttpClient())  
    {  
        client.DefaultRequestHeaders.Add("Authorization", "Bearer " + GetAccessToken());  
        string requestURl = _baseURI + $"subscriptions/{_SubscriptionId}/resourceGroups/{_ResourceGroupName}/providers/Microsoft.Web/sites/{_AppName}/hostNameBindings/{sHostName}?api-version=2021-02-01";  
          
        return await client.DeleteAsync(requestURl);  
    }  
}  
  

169508-image.png

Does anyone have any ideas? Could this be a bug in the API?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,776 questions
{count} votes

0 additional answers

Sort by: Most helpful