question

RanjithMadayiVeedu-9582 avatar image
0 Votes"
RanjithMadayiVeedu-9582 asked ChaitanyaNaykodiMSFT-9638 answered

Not able to delete resource group

Hi,

I am not able to delete my resource group and am getting the below error -

Failed to delete resource group myResourceGroup: Deletion of resource group 'myResourceGroup' failed as '8' resources could not be deleted. The provisioning state of the resource group will be rolled back. The tracking Id is '568a6d24-2ad9-4d60-92c5-1989598f01f0'. Please check audit logs for more details. (Code: ResourceGroupDeletionBlocked) Service Endpoint Policy /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/serviceEndpointPolicies/_e41f87a2_mi_a5275d69-d0d4-4bf3-b448-1e62fa69978a cannot be deleted because it is in use with contextual service endpoint policy(s) ManagedInstanceContextualPolicy. (Code: ServiceEndpointPolicyCannotBeDeletedIfReferencedByContextualServiceEndpointPolicy, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/serviceEndpointPolicies/_e41f87a2_mi_a5275d69-d0d4-4bf3-b448-1e62fa69978a) Subnet ManagedInstance is in use by /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Sql/virtualClusters/VirtualClusteref338c98-9260-43af-9f61-6ad18a2111b6?api-version=2015-05-01-preview and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet. (Code: InUseSubnetCannotBeDeleted, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet-mymanagedinstance1) Route table rt-mymanagedinstance1 is in use and cannot be deleted. (Code: InUseRouteTableCannotBeDeleted, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/routeTables/rt-mymanagedinstance1) Service Endpoint Policy /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/serviceEndpointPolicies/_e41f87a2_pdc_fd99fadf-cfaa-4b09-a14e-943393518ead cannot be deleted because it is in use with contextual service endpoint policy(s) ManagedInstanceContextualPolicy. (Code: ServiceEndpointPolicyCannotBeDeletedIfReferencedByContextualServiceEndpointPolicy, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/serviceEndpointPolicies/_e41f87a2_pdc_fd99fadf-cfaa-4b09-a14e-943393518ead) The request to delete the resource 'Microsoft.Sql/virtualClusters/VirtualClusteref338c98-9260-43af-9f61-6ad18a2111b6' failed. subscription id '98a90fa1-0cc4-4220-9f1f-3a60b57de805', activity id 'c6e229e5-0609-465c-8bcf-d3a88fcebe17', request correlation id '568a6d24-2ad9-4d60-92c5-1989598f01f0'. (Code: ResourceDeletionFailed, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Sql/virtualClusters/VirtualClusteref338c98-9260-43af-9f61-6ad18a2111b6) Network Intent Policy /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkIntentPolicies/mi_default_f0a5e739-9365-454d-816c-ebb68c423987_10-0-0-0-24 cannot be deleted because it is in use with subnet(s) ManagedInstance. (Code: NetworkIntentPolicyCannotBeDeletedIfReferencedBySubnet, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkIntentPolicies/mi_default_f0a5e739-9365-454d-816c-ebb68c423987_10-0-0-0-24) Subscription '98a90fa1-0cc4-4220-9f1f-3a60b57de805' does not have the server 'mymanagedinstance1'. (Code: ServerNotInSubscription, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Sql/managedInstances/mymanagedinstance1) Network security group /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/nsg-mymanagedinstance1 cannot be deleted because it is in use by the following resources: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet-mymanagedinstance1/subnets/ManagedInstance. In order to delete the Network security group, remove the association with the resource(s). To learn how to do this, see aka.ms/deletensg. (Code: InUseNetworkSecurityGroupCannotBeDeleted, Target: /subscriptions/98a90fa1-0cc4-4220-9f1f-3a60b57de805/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/nsg-mymanagedinstance1)

Kindly let me know why I am not able to delete the resource group.

Thanks,
Ranjith

azure-virtual-networkazure-sql-virtual-machines
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ChaitanyaNaykodiMSFT-9638 avatar image
0 Votes"
ChaitanyaNaykodiMSFT-9638 answered

Hello @RanjithMadayiVeedu-9582, Thank you for reaching out. When you are deleting resource group which contains infra resources like Virtual Networks, virtual machines etc. you need disassociate/delete any dependent resources first then delete the infra resources. From the error shared above for the Service Endpoint Policy I think you need disassociate/delete any dependencies it has before attempting to delete it. To delete any subnet, you need to delete resources in the subnet first. Similarly you can delete a virtual network only if there are no resources connected to it. You can follow this guideline to delete a virtual network in Azure.
Hope this helps! Please let me know if the issue still persists. Thank you!


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.