Unable to delete the custom domain

We are not able to destroy a custom domain as we are experiencing the following error during deletion.

 Error: deleting "Custom Domain: (Name \"cdn-endpoint-custom-domain\" / Endpoint Name \"xxxxresourcescigky1fd\" / Profile Name \"xxxxresourcescigky1fd\" / Resource Group \"xxxxcigky1fd\")": cdn.CustomDomainsClient#Delete: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="Conflict" Message="Cannot delete custom domain \"cdn-xxxx.com\" because it is still directly or indirectly (using \"cdnverify\" prefix) CNAMEd to CDN endpoint \"xxxxresourcescigky1fd.azureedge.net\". Please remove the DNS CNAME record and try again."

We disabled Check For Custom Domain Deletion using the following command but still getting the same error.
az feature register --namespace Microsoft.Network --name BypassCnameCheckForCustomDomainDeletion

Any assistance is appreciated.

@manfrednde The correct command to run for this is az feature register --namespace Microsoft.Cdn --name BypassCnameCheckForCustomDomainDeletion. It’s a very subtle difference, and I’m doing my best to correct this confusion across the internet. :slight_smile: