I think, there are orphaned links associated with the resources you are trying to delete and because of that, the deletion is not working. We will have the following options
- Update the objects like Network rules collection associated with the firewall
In-order to do that, try the following
Name variables are given on the basis of error messages posted. Still you need to find out NetworkRuleCollectionGroupName and to substitute in the following command. Note that, I am just updating the 'Priority' value to 220 to have a simple update in the rule
$firewallpolicy = Get-AzFirewallPolicy -Name FirewallPolicy_AZFW01 -ResourceGroupName AZ-VNET-RG
$networkrulecollectiongroup = Get-AzFirewallPolicyRuleCollectionGroup -Name "NetworkRuleCollectionGroupName" -ResourceGroupName AZ-VNET-RG -AzureFirewallPolicyName FirewallPolicy_AZFW01
Set-AzFirewallPolicyRuleCollectionGroup -Name "NetworkRuleCollectionGroupName" -Priority "220" -FirewallPolicyObject $firewallpolicy -RuleCollection $networkrulecollectiongroup.Properties.RuleCollection
If the above commands works well, try a deletion again
- For any reason, the steps are not helping, we need Microsoft team's support to fix this by deleting the orphaned objects in the backend. If you have a paid subscription, raise a case. Otherwise, shoot an email to AzCommunity@microsoft.com with the details, so that, someone can support you further
--please don't forget to upvote
and Accept as answer
if the reply is helpful--