On Azure, I need to disassociate an existing WAF policy that is tied to an Azure Application Gateway but cannot find a way.
I've created a new WAF policy and associated it with my Azure Application Gateway. I do not like the way it is configured and would now like to remove it but it gives me an error message saying
Failed to delete the WAF policy 'wafpolicyNew'. Error: Firewall Policy
can not be deleted since it is still allocated to resource subscriptions/75d2e0ac-xxxxx450c0a6fc/resourceGroups/xxx/providers/Microsoft.Network/applicationGateways/mygateway
Is there any way I can disassociate the policy from my Application Gateway?
I've tried using Powershell
$appGw = Get-AzApplicationGateway -Name "mygateway"
$appGw.FirewallPolicy = $null
Set-AzApplicationGateway -ApplicationGateway $appGw
But I get another error message saying
cannot be removed from Application Gateway, changing from one firewall
policy to another is permitted
and also tried using the Portal to look for a disassociate button but none to be found.
Best Answer
WAF policies can be deleted from an application gateway by using the Azure CLI.
Stop the application gateway.
Remove the policy