Snippets

Azure snippet: audit WAF custom rule priorities

A short command to list custom rules in an Azure WAF policy with priority, action and type before an urgent change.

05 Jun 2026 azurewafrunbookrollbacksecurityapplication-gatewayautomation

Before adding an Azure WAF custom rule, check existing priorities so the emergency rule is not placed too high or made broader than a rule that is already more specific.

audit-waf-custom-rules.sh

RG=rg-network-prod
POLICY=wafpol-app-prod

az network application-gateway waf-policy show \
  --resource-group "$RG" \
  --name "$POLICY" \
  --query "customRules[].[priority,name,action,ruleType,state]" \
  -o table

Use it in the change runbook: document the chosen priority, the Block, Allow or Log action, then prepare the disable command before publishing the rule.