I have an Application Gateway WAF policy.
I want to update the existing custom rule by adding another IP address.
How can I do this dynamically from Powershell or Azure CLI?
I have an Application Gateway WAF policy.
I want to update the existing custom rule by adding another IP address.
How can I do this dynamically from Powershell or Azure CLI?
I used the below, depending on your scenario you may need to use the equivalent list
function first to get the existing IP addresses and Index order - as this overwrites the existing rule. Details https://learn.microsoft.com/en-us/cli/azure/network/application-gateway/waf-policy/custom-rule?view=azure-cli-latest
az network application-gateway waf-policy custom-rule match-condition add --resource-group MyResGroup --policy-name MyWafPolicyName --name MyCustomRuleName --index 1 --match-variables RemoteAddr --operator IPMatch --values "[192.168.1.1,192.168.2.2]"
I tried to reproduce the same in my environment I got the results successfully like below:
I have created Azure Application Gateway WAF Policy and I created Custom Rule with Ip address like below:
To update the existing custom rule by adding another IP address make use of below command:
Result:
When I check in portal the existing custom rule of IP address are updated successfully like below:
update
As per command I want to add another IP in the same rule make use of below script like below:
When I use this command another IP added successfully like below: