azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Not Able to delete private azure dns zone even if there is no nested link

Open digeler opened this issue 4 years ago • 44 comments

Describe the bug Cannot delete private dns zone even if there are no nested links

To Reproduce create global zone and try to delete

Expected behavior zone should be deleted , if there is no nested resources in it.

Environment summary PS C:\Users\digeler> az network private-dns zone show -n documents.azure.com -g polydgeuse1 { "etag": "a69969af-60b0-4490-8059-1906c48b48c9", "id": "/subscriptions/a9f4e502-9188-4e9c-857f-532dd66f5d0c/resourceGroups/polydgeuse1/providers/Microsoft.Network/privateDnsZones/documents.azure.com", "location": "global", "maxNumberOfRecordSets": 25000, "maxNumberOfVirtualNetworkLinks": 1000, "maxNumberOfVirtualNetworkLinksWithRegistration": 100, "name": "documents.azure.com", "numberOfRecordSets": 1, "numberOfVirtualNetworkLinks": 0, "numberOfVirtualNetworkLinksWithRegistration": 0, "provisioningState": "Succeeded", "resourceGroup": "polydgeuse1", "tags": null, "type": "Microsoft.Network/privateDnsZones" }

rllib3.connectionpool : https://management.azure.com:443 "DELETE /subscriptions/a9f4e502-9188-4e9c-857f-532dd66f5d0c/resourceGroups/polydgeuse1/providers/Microsoft.Network/privateDnsZones/documents.azure.com?api-version=2018-09-01 HTTP/1.1" 409 114 msrest.http_logger : Response status: 409 msrest.http_logger : Response headers: msrest.http_logger : 'Cache-Control': 'no-cache' msrest.http_logger : 'Pragma': 'no-cache' msrest.http_logger : 'Content-Length': '114' msrest.http_logger : 'Content-Type': 'application/json; charset=utf-8' msrest.http_logger : 'Expires': '-1' msrest.http_logger : 'x-ms-failure-cause': 'gateway' msrest.http_logger : 'x-ms-request-id': '92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'x-ms-correlation-request-id': '92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'x-ms-routing-request-id': 'GERMANYWESTCENTRAL:20200901T100854Z:92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains' msrest.http_logger : 'X-Content-Type-Options': 'nosniff' msrest.http_logger : 'Date': 'Tue, 01 Sep 2020 10:08:54 GMT' msrest.http_logger : Response content: msrest.http_logger : {"error":{"code":"CannotDeleteResource","message":"Can not delete resource before nested resources are deleted."}} msrest.exceptions : Can not delete resource before nested resources are deleted. cli.azure.cli.core.util : Can not delete resource before nested resources are deleted. Can not delete resource before nested resources are deleted.

digeler avatar Sep 01 '20 10:09 digeler

network

yonzhan avatar Sep 01 '20 12:09 yonzhan

Based on the error output, I think the service protect deletion from this situation while there is nested resource linked to it.

And, the docs says:

Private DNS zone cannot be deleted unless all virtual network links to it are removed.

Could you please check whether there are some resources linked to it and remove them first?

If you insist that the nested resource should be deleted automatically, I will mark this issue as Service Attention to let service guy help.

haroldrandom avatar Sep 17 '20 05:09 haroldrandom

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.

ghost avatar Sep 22 '20 06:09 ghost

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.

ghost avatar Sep 22 '20 06:09 ghost

@digeler Also, you could provide feedback in the page https://docs.microsoft.com/en-us/azure/dns/private-dns-overview through that feedback button

haroldrandom avatar Sep 22 '20 06:09 haroldrandom

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dnssuppgithub.

ghost avatar Sep 22 '20 14:09 ghost

Hi I experienced the same issue that I can't delete my prirvate dns zone which has no nested resources(no vnet link, only the automatically created SOA record) I am wondering is it a known bug? And is there any plan on fixing it? Wondering if we should file an azure support ticket to get some help deleting it?

nezuko-cc avatar Dec 17 '20 01:12 nezuko-cc

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dnssuppgithub.

Issue Details

Describe the bug Cannot delete private dns zone even if there are no nested links

To Reproduce create global zone and try to delete

Expected behavior zone should be deleted , if there is no nested resources in it.

Environment summary PS C:\Users\digeler> az network private-dns zone show -n documents.azure.com -g polydgeuse1 { "etag": "a69969af-60b0-4490-8059-1906c48b48c9", "id": "/subscriptions/a9f4e502-9188-4e9c-857f-532dd66f5d0c/resourceGroups/polydgeuse1/providers/Microsoft.Network/privateDnsZones/documents.azure.com", "location": "global", "maxNumberOfRecordSets": 25000, "maxNumberOfVirtualNetworkLinks": 1000, "maxNumberOfVirtualNetworkLinksWithRegistration": 100, "name": "documents.azure.com", "numberOfRecordSets": 1, "numberOfVirtualNetworkLinks": 0, "numberOfVirtualNetworkLinksWithRegistration": 0, "provisioningState": "Succeeded", "resourceGroup": "polydgeuse1", "tags": null, "type": "Microsoft.Network/privateDnsZones" }

rllib3.connectionpool : https://management.azure.com:443 "DELETE /subscriptions/a9f4e502-9188-4e9c-857f-532dd66f5d0c/resourceGroups/polydgeuse1/providers/Microsoft.Network/privateDnsZones/documents.azure.com?api-version=2018-09-01 HTTP/1.1" 409 114 msrest.http_logger : Response status: 409 msrest.http_logger : Response headers: msrest.http_logger : 'Cache-Control': 'no-cache' msrest.http_logger : 'Pragma': 'no-cache' msrest.http_logger : 'Content-Length': '114' msrest.http_logger : 'Content-Type': 'application/json; charset=utf-8' msrest.http_logger : 'Expires': '-1' msrest.http_logger : 'x-ms-failure-cause': 'gateway' msrest.http_logger : 'x-ms-request-id': '92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'x-ms-correlation-request-id': '92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'x-ms-routing-request-id': 'GERMANYWESTCENTRAL:20200901T100854Z:92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains' msrest.http_logger : 'X-Content-Type-Options': 'nosniff' msrest.http_logger : 'Date': 'Tue, 01 Sep 2020 10:08:54 GMT' msrest.http_logger : Response content: msrest.http_logger : {"error":{"code":"CannotDeleteResource","message":"Can not delete resource before nested resources are deleted."}} msrest.exceptions : Can not delete resource before nested resources are deleted. cli.azure.cli.core.util : Can not delete resource before nested resources are deleted. Can not delete resource before nested resources are deleted.

Author: digeler
Assignees: haroldrandom
Labels:

Network - DNS, Service Attention, feature-request

Milestone: Backlog

ghost avatar Dec 17 '20 16:12 ghost

I also ran into this problem today.

gro1m avatar Jan 21 '21 16:01 gro1m

Had this exact problem today. I tried deleting the resource-group in which the DNS zone was located and that actually finished successfully. But I imagine not everyone can afford to delete the whole resource-group...

0papen0 avatar Jan 26 '21 14:01 0papen0

hi, same issue here. It seems that if you try to move the resource somewhere else you can see that there still a linked vnet (even though its not currently visible). The only solution i found so far is to wait.....and retry and wait.

jessicalavoie avatar Feb 18 '21 18:02 jessicalavoie

Hey, Have same situation, created private dns zone, tried to link it to vnet(it failed, because vnet already have dns zone with auto-registration).

Now Iam trying to create empty zone, but it throws: "Can not delete resource before nested resources are deleted."

helltone avatar Apr 08 '21 10:04 helltone

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dnssuppgithub.

Issue Details

Describe the bug Cannot delete private dns zone even if there are no nested links

To Reproduce create global zone and try to delete

Expected behavior zone should be deleted , if there is no nested resources in it.

Environment summary PS C:\Users\digeler> az network private-dns zone show -n documents.azure.com -g polydgeuse1 { "etag": "a69969af-60b0-4490-8059-1906c48b48c9", "id": "/subscriptions/a9f4e502-9188-4e9c-857f-532dd66f5d0c/resourceGroups/polydgeuse1/providers/Microsoft.Network/privateDnsZones/documents.azure.com", "location": "global", "maxNumberOfRecordSets": 25000, "maxNumberOfVirtualNetworkLinks": 1000, "maxNumberOfVirtualNetworkLinksWithRegistration": 100, "name": "documents.azure.com", "numberOfRecordSets": 1, "numberOfVirtualNetworkLinks": 0, "numberOfVirtualNetworkLinksWithRegistration": 0, "provisioningState": "Succeeded", "resourceGroup": "polydgeuse1", "tags": null, "type": "Microsoft.Network/privateDnsZones" }

rllib3.connectionpool : https://management.azure.com:443 "DELETE /subscriptions/a9f4e502-9188-4e9c-857f-532dd66f5d0c/resourceGroups/polydgeuse1/providers/Microsoft.Network/privateDnsZones/documents.azure.com?api-version=2018-09-01 HTTP/1.1" 409 114 msrest.http_logger : Response status: 409 msrest.http_logger : Response headers: msrest.http_logger : 'Cache-Control': 'no-cache' msrest.http_logger : 'Pragma': 'no-cache' msrest.http_logger : 'Content-Length': '114' msrest.http_logger : 'Content-Type': 'application/json; charset=utf-8' msrest.http_logger : 'Expires': '-1' msrest.http_logger : 'x-ms-failure-cause': 'gateway' msrest.http_logger : 'x-ms-request-id': '92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'x-ms-correlation-request-id': '92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'x-ms-routing-request-id': 'GERMANYWESTCENTRAL:20200901T100854Z:92920106-a73e-461a-8dd0-e320966bcdc5' msrest.http_logger : 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains' msrest.http_logger : 'X-Content-Type-Options': 'nosniff' msrest.http_logger : 'Date': 'Tue, 01 Sep 2020 10:08:54 GMT' msrest.http_logger : Response content: msrest.http_logger : {"error":{"code":"CannotDeleteResource","message":"Can not delete resource before nested resources are deleted."}} msrest.exceptions : Can not delete resource before nested resources are deleted. cli.azure.cli.core.util : Can not delete resource before nested resources are deleted. Can not delete resource before nested resources are deleted.

Author: digeler
Assignees: msyyc
Labels:

Network - DNS, Service Attention, feature-request

Milestone: Backlog

ghost avatar Apr 08 '21 19:04 ghost

As a workaround you can move the private dns zone into a new ressource group and than just delete the new created ressource group

BMeyn avatar Apr 13 '21 09:04 BMeyn

@BMeyn unfortunately this solution does not work for me, it's not possible to move the DNS zone, stuck in some faulty state now.

RichardNixon52 avatar Apr 13 '21 12:04 RichardNixon52

@BMeyn 's solution works. When deleting the resource group, it highlighted an additional resource type that i did not see in my original resource group and i think this is the "nested resource" it's complaining about. It's this type: Microsoft.Network/privateDnsZones/virtualNetworkLinks

lordhits avatar Apr 21 '21 15:04 lordhits

This also happens in the Portal the error is: image

frehnejc avatar May 12 '21 03:05 frehnejc

Same issue for me. Since 6 month, is there any offical fix from Azure ?

93420 avatar Jun 09 '21 17:06 93420

network service team should look into this.

yonzhan avatar Jun 09 '21 22:06 yonzhan

What worked for me is to delete first the Virtual network links before trying to delete the zone.

montaro avatar Jul 25 '21 20:07 montaro

What worked for me is to delete first the Virtual network links before trying to delete the zone.

@montaro Thank you! That worked for me as well

antonmatsiuk avatar Oct 19 '21 07:10 antonmatsiuk

I'm in the same situation.

seanyao1 avatar Oct 23 '21 01:10 seanyao1

I had the same issue this morning. The problem was that the vnet link was in a bad state. For some reason it was not showing up the in the portal. I had to add the vnet link to the private dns zone and delete it once again to be able to delete the private dns zone.

fidelcasto avatar Dec 07 '21 16:12 fidelcasto

FIX! Go into resource group where you are trying to delete private DNS. Check off the "show hidden types". A vnet link for private dns will show up now. Delete that first, then delete private dns. Done.

ozesati avatar Jan 19 '22 18:01 ozesati

Delete the attached "microsoft.network/privatednszones/virtualnetworklinks" (hidden) resources to delete the "Private DNS zone".

dcnsakthi avatar Jan 24 '22 09:01 dcnsakthi

I have the following error:

'xxx' does not have authorization to perform action 'Microsoft.Network/privateEndpoints/privateDnsZoneGroups/delete' over scope 'yyy'

However, the provider-operation Microsoft.Network/privateEndpoints/privateDnsZoneGroups/delete does not exist. Any ideas?

lordisp avatar Mar 08 '22 00:03 lordisp

does

You need to be assigned contributor role in the IAM menu of the ressource you want to delete.

fidelcasto avatar Mar 08 '22 01:03 fidelcasto

You need to be assigned contributor role in the IAM menu of the ressource you want to delete.

@fidelcasto I your answer is a replay to my post, I don't want to assign the contributor role. Insead I'm working on a custom role for a service-principal in azure-devops pipeline. However the failed provider-operation does not exist.

lordisp avatar Mar 08 '22 08:03 lordisp

FIX! Go into resource group where you are trying to delete private DNS. Check off the "show hidden types". A vnet link for private dns will show up now. Delete that first, then delete private dns. Done.

Excellent fix!

For my Azure subscription the view has changed/updated: Indeed go to the resource group, click on "Manage View" click on "Show Hidden Types"

MartinJoeWilco avatar Jun 15 '22 16:06 MartinJoeWilco

[dcnsakthi](https://github.com/dcnsakthi) commented [on Jan 24](https://github.com/Azure/azure-cli/issues/15010#issuecomment-1019893921)
Delete the attached "microsoft.network/privatednszones/virtualnetworklinks" (hidden) resources to delete the "Private DNS zone".

This resolved the issue for me.

edgreenberg-mri avatar Jul 18 '22 14:07 edgreenberg-mri