Cloud
Azure WAF: validate HTTP DDoS learning before enabling blocking
A production runbook for qualifying the HTTP DDoS ruleset on Application Gateway WAF v2, reading learning, penalty-box metrics and legitimate peaks, then deciding Log, Block or rollback.
A public API behind Application Gateway WAF v2 sees occasional traffic peaks: a sale opens at 09:00, a partner synchronizes data, a scheduled load test starts, and automated scanners keep arriving. The team wants the HTTP DDoS ruleset to absorb an application-layer flood without authoring emergency rules during the incident.
The control learns normal traffic before it acts. That changes the runbook: a policy that deployed cleanly is not yet a qualified protection, and a load test run during learning can distort the reference. Moving too quickly to Block can also put a legitimate IP into the penalty box for fifteen minutes. During the Application Gateway preview, a specific IP cannot be exempted from the ruleset or penalty box.
This runbook ends with one bounded decision: keep rules 500100 and 500110 in Log, enable Block with the observed sensitivity, hold the change, or restore the previous policy artifact.
Freeze the scope before learning
Record the policy that is actually attached, the gateway, listeners, hostnames and WAF mode. The ruleset learns at gateway scope rather than independently for each business route. A seasonal listener, health-check hostname or high-volume partner therefore contributes to the observed context even when the team is focused on one API.
change: CHG-WAF-DDOS-118
window_utc: 2026-11-15T18:00:00Z/2026-11-18T18:00:00Z
application_gateway:
resource_id: <application-gateway-resource-id>
sku: WAF_v2
waf_policy_id: <policy-resource-id>
listeners: [api-public, portal-public]
hostnames: [api.example.net, portal.example.net]
http_ddos_ruleset:
type: Microsoft_HTTPDDoSRuleSet
version: "1.0"
rule_500100_action: Log
rule_500100_sensitivity: Medium
rule_500110_action: Log
rule_500110_sensitivity: Medium
known_events:
- partner-batch-0600-utc
- sales-opening-0900-utc
- synthetic-probes
evidence:
baseline_owner: platform-security
rollback_commit: <commit>
rollback_owner: <role> The ruleset is in preview on Application Gateway WAF v2. Put that constraint in the production decision because support, behavior and metrics can evolve. It does not replace L3/L4 DDoS protection for the public IP, Bot Manager, a targeted rate limit, or enough origin headroom to survive the time before mitigation engages.
Build a business baseline before reading WAF signals
Before attaching the ruleset, measure at least one period covering normal cycles. A useful baseline is more than requests per second. It connects rate, clients, routes and backend capacity.
Retain for each window:
- total requests and requests per hostname;
- distinct client IPs and concentration among leading sources;
- dominant routes, HTTP status codes and user agents;
- planned peaks, partner batches and load tests;
- origin latency, errors, saturation and autoscale;
- custom rate limits, Bot Manager and emergency rules already active.
A legitimate event can resemble a flood when thousands of users arrive together. A partner batch can instead concentrate normal volume behind a few IPs. Those profiles require different interpretations of 500100, which detects an anomalous client request rate, and 500110, which targets high-rate traffic from clients classified as suspected bots.
window,hostname,event,requests,distinct_clients,top_client_share,backend_p95_ms,backend_5xx
weekday-0900,api.example.net,sales-opening,<count>,<count>,<percent>,<value>,<count>
weekday-0600,api.example.net,partner-batch,<count>,<count>,<percent>,<value>,<count>
night,portal.example.net,organic-low,<count>,<count>,<percent>,<value>,<count>
test-window,api.example.net,planned-load-test,<count>,<count>,<percent>,<value>,<count> Do not try to accelerate learning with one load test. Application Gateway learns for at least twenty-four hours and needs enough traffic to establish a reference. An artificial burst represents neither the real client mix nor the service’s normal cycle.
Enable Log and protect the learning window
Attach Microsoft_HTTPDDoSRuleSet_1.0 with both rules set to Log and an explicitly versioned sensitivity. During learning, avoid hostname migrations, cache changes, exceptional campaigns and unannotated load tests. When one is unavoidable, record its time, source IPs and routes so operators can recognize it in the evidence.
The model evaluates a global threshold and per-IP thresholds. A client threshold is enforced only after traffic also breaches the global reference. This means one busy IP is not automatically penalized outside a global surge. It also means every signal has to be correlated with total gateway volume.
Do not switch to Block exactly when twenty-four hours have elapsed. Minimum duration is not evidence of baseline quality. The record should cover a representative cycle, show sufficient traffic, and explain every exceptional event inside the window.
Read logs with penalty-box metrics
When an IP breaches a threshold, WAF logs the first match and puts the IP in the penalty box. Following requests blocked during that period do not each produce an equivalent WAF event. Counting log rows alone therefore understates user impact.
On Application Gateway, correlate four sources:
- WAF logs for
ruleId, hostname, URI, client and first decision; - WAF Managed Rule Match metric;
- Penalty box size metric for IPs currently penalized;
- Penalty box blocks metric for the request volume actually blocked by the penalty box.
let Start = datetime(2026-11-15T18:00:00Z);
let End = datetime(2026-11-18T18:00:00Z);
WafHttpDdosEvents
| where TimeGenerated between (Start .. End)
| where RuleId in ("500100", "500110")
| summarize
FirstHits=count(),
Clients=dcount(ClientIp),
Routes=make_set(RequestRoute, 20)
by RuleId, Action, Hostname, bin(TimeGenerated, 15m)
| order by TimeGenerated asc WafHttpDdosEvents is an operational projection, not a native Azure table. Build it from the diagnostic mode you actually enabled and retain raw events. Add Azure Monitor metrics on the same timeline because one initial hit can correspond to many penalty-box blocks.
An empty penalty box does not prove that learning is ready, and active metrics do not prove that blocked traffic is hostile. The analysis must connect each signal with a route, business event and backend state.
Test legitimate peaks before Block
Replay no-side-effect canaries after learning while actions remain Log. Cover an isolated high-rate client, many clients during a global peak, a known bot user agent, a concentrated partner IP, and a distributed user journey.
Case Expected evidence
Organic distributed peak Backend stays healthy; no concentrated false positive
Known partner batch Source and route identified; business success confirmed
Approved load generator Window annotated; 500100 outcome understood
Suspected bot burst 500110 signal visible; no legitimate journey mixed in
Single noisy client, normal global No conclusion without checking global threshold context
Backend saturation without WAF hit Capacity incident, not proof of HTTP DDoS mitigation Do not treat an Allow rule as an implicit exemption plan. A custom Allow rule does not bypass the HTTP DDoS ruleset, and the Application Gateway preview cannot remove one IP from the penalty box. If a load generator or critical partner might be penalized, stay in Log until the test window and application behavior are compatible.
Validate negative controls too. A small legitimate ramp should not be treated as an attack, while an authorized flood test should produce the expected signals without saturating the origin. The objective is to prove the operating model, not find the maximum throughput.
Stage enforcement and define stop conditions
Each rule has its own action and sensitivity. Move one rule at a time when their traffic profiles differ. 500110 may be ready on a surface dominated by bots while 500100 remains in Log to observe a concentrated partner. Do not increase sensitivity and enable Block in the same change because the cause of new behavior would be ambiguous.
Define stop conditions before enforcement: a critical journey denied, a partner IP in the penalty box, correlated legitimate 403 growth, rising Penalty box blocks without an identified hostile event, missing logs, increased backend errors, or inability to separate the ruleset from a custom rate limit.
Keep synthetic probes, business success rate, backend latency and errors, WAF events, penalty-box metrics and autoscale changes on one timeline. A WAF mitigation that protects the origin but drops a payment callback is still an incident.
Decide Log, Block or rollback
Enable Block when learning covers significant cycles, 500100 and 500110 are understood separately, legitimate peaks have been canaried, and penalty-box metrics feed actionable alerts. Backend capacity and the other DDoS layers must remain in place.
Stay in Log when the gateway has little traffic, recently changed scope, has not crossed a major business event, or operators cannot distinguish a legitimate shared IP. Hold as well when Penalty box size and Penalty box blocks are not visible.
Roll back by applying the previous artifact that returns both rules to Log, without adding a broad emergency exception. Verify the policy that is actually attached, replay a critical journey, and watch blocks disappear for at least the fifteen-minute penalty-box duration. Preserve logs, metrics, IPs and routes so sensitivity can be corrected outside the incident.
Conclusion
The HTTP DDoS ruleset is not an anti-flood switch. It is an adaptive control whose quality depends on the traffic it learns, the peaks the team can explain, and the telemetry used to measure the penalty box.
The production decision is explicit: extend learning in Log, enable one rule in Block, keep the other under observation, or restore the previous policy. This runbook prevents teams from mistaking twenty-four elapsed hours for a qualified baseline, or one log row for the real impact of enforcement.