Update: Issue resolved by changing the API version to 2020-12-01 and adding correct resource group.
Azure Management REST API Delete Certificate Does Not Delelete Despite Response Code 200

David Warwick
121
Reputation points
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);
}
}
Does anyone have any ideas? Could this be a bug in the API?
{count} votes
Accepted answer
-
0 additional answers
Sort by: Most helpful