An Azure service that provides protection for web apps.
Hey @RJ — that does sound frustrating. Based on what you shared, the key symptoms are:
- Both WAF policies are identically configured and in Prevention mode
- The older/manual deployment behaves as expected
- The new Terraform deployment instead geo-blocks IPs from your virtual network, returning 403 with:
“Access denied with code 403. Found condition 0 in RemoteAddr”
This strongly suggests the request is being evaluated against your custom allow/deny logic using RemoteAddr, and for those VN traffic flows, the value WAF is seeing for RemoteAddr is different than expected (or your allow/geo conditions are not matching that value the same way in the new deployment).
The most important step is to validate the actual value WAF is matching.
- Enable Application Gateway WAF diagnostic logs (Firewall logs)
- Query Log Analytics around the time of a blocked request
- Identify:
- ruleId that caused the block
- details (matched variable + value)
- transactionId to trace the full request
- details (matched variable + value)
- ruleId that caused the block
Since your error explicitly references RemoteAddr, this will confirm whether the IP being evaluated has changed in the Terraform deployment.
Custom rules are evaluated in priority order (lower number = higher priority), and even small differences can change behavior.
Recommended structure:
- 1–100 → Allow trusted CIDRs (Action: Allow, Variable: RemoteAddr)
- 200–900 → Scoped exceptions
- 1000+ → Default deny/block
If the deny rule is evaluated before the allow rule in the Terraform deployment, traffic will be blocked even if configs look identical.
While you mentioned “ZZ (Unknown)” handling, the more likely issue is not geo itself but:
The evaluated
RemoteAddrdiffers, so geo/allow logic doesn’t match as expected.
So the priority remains confirming via logs what value is actually being matched.
In practice, there can still be effective differences such as:
- Slight priority/order changes introduced by Terraform
- Differences in how rules are rendered/applied
- Traffic path changes affecting the client IP seen by WAF
- Missing exclusions or implicit tuning from the older deployment
This is why log-driven validation is key, especially in Prevention mode.
If you can share the following for one blocked request, it will pinpoint the issue:
- WAF type (Application Gateway vs Front Door)
- From logs:
- ruleId
- details_data_s (matched value)
- details_file_s (e.g., RemoteAddr)
- Custom rule priorities in both policies
- Any exclusions or extra rules in the older deployment
- Whether this affects all VN IPs or only specific ranges.
Let me know if there are any results.
Kindly let us know if the above helps or you need further assistance on this issue.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".