How to delete a private DNS zone in Azure?

William Menezes 0 Reputation points
2025-09-10T00:17:31.21+00:00

I'm trying to delete a private DNS resource that was never provisioned correctly.

Errors I'm receiving:

  • Portal: I'm getting a generic "The resource operation completed with the terminal provisioning state 'Failed'" when trying to delete the resource in the Azure portal.

Az PS:

Remove-AzResource -ResourceId "/subscriptions/4a59ff40-b8a0-498d-962b-995a9e4d9e28/resourceGroups/az104-rg4/providers/Microsoft.Network/privateDnsZones/private.acmecorp.com" -Force -Confirm:$false 
  • When I tried the command above, I receive:
    • Remove-AzResource:{"code":"BadRequest","message":"The request was invalid."} CorrelationId: 4d701a5b-4760-4eba-a2c2-6ec57789422a

Things I've checked:

  • I have owner access to the resource
  • There are no locks on the resource
  • There are no Vnets linked
  • There are no recordsets (except the default)
Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Priya ranjan Jena 2,295 Reputation points Microsoft External Staff Moderator
    2025-09-10T03:05:58.9566667+00:00

    Hi William Menezes,

    Thank you for reaching out on Microsoft Q&A forum

    To help you with above blocker , please try to execute below steps:

    From portal

    • Please navigate to the Azure portal, go to Resource Groups, select the resource group that contains your private DNS zone, and then try to delete it from there.
    • Sometimes accessing the resource from RG can help & can provide more detailed error messages.
    • Please check any dependencies on custom roles or policies attached to the resource.

    Via Power shell

    • Instead of usingRemove-AzResource, which is generally for Azure resources , try using following command to delete a DNS zone, this command targets the DNS zone directly .
    Remove-AzDnsZone -Name "private.acmecorp.com" -ResourceGroupName "az104-rg4"
    
    • Sometimes resources get stuck in a failed state and cannot be deleted until its state is reset, so we can try a state reset which may trigger a new provisioning cycle and allow deletion afterward.

    Use the following command to do above:

    Set-AzPrivateDnsZone -ResourceGroupName "az104-rg4" -Name "private.acmecorp.com"

    Via CLI

    We can also try to delete from azure CLI, please try below cmd to delete the resource.

    az network private-dns zone delete --resource-group az104-rg4 --name private.acmecorp.com

    If you find this comment helpful, please “up-vote” for the information provided , this can be beneficial to community members.

    Kindly let us know if you have any additional questions.

    Thanks

    0 comments No comments

  2. TP 145.1K Reputation points Volunteer Moderator
    2025-09-10T03:14:32.5833333+00:00

    Hi William,

    Please open Azure Cloud Shell (PowerShell mode) and run command similar to below:

    Remove-AzPrivateDnsZone -Name private.acmecorp.com -ResourceGroupName az104-rg4 -Debug -Confirm:$false
    
    

    By using -Debug you should get more information that we can examine for clues as to why the deletion is failing. You can copy/paste the output into Notepad.

    If you would like you can reply in comment with output as an attachment, but please obfuscate anything confidential first. Things like subscription id, tenant id, zone name, etc.

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.