Application Gateway should have WAF enabled
High
Azure
General
appgw-waf
Applies to
Microsoft.Network/applicationGateways
What CGPulse checks
A resource passes this rule when webApplicationFirewall.enabled must equal true. Anything else is reported as a finding with the evaluated property value attached as evidence.
How to fix it
Enable WAF to block common web attacks like SQL injection and XSS. In Azure Portal: Application Gateway > Web application firewall > enable WAF (requires WAF_v2 SKU). See: https://learn.microsoft.com/en-us/azure/web-application-firewall/ag/ag-overview
CLI
az network application-gateway waf-config set --gateway-name "{name}" -g "{rg}" --enabled true --firewall-mode Prevention --rule-set-version 3.2Bicep
// TODO: Start with Detection mode to monitor before switching to Prevention
resource appGw 'Microsoft.Network/applicationGateways@2023-11-01' existing = {{
name: '{name}'
}}
// Note: WAF requires sku.name = 'WAF_v2'. If currently Standard_v2, update the SKU firstTerraform
# WAF requires WAF_v2 SKU - may increase costs
resource "azurerm_application_gateway" "{name}" {
name = "{name}"
resource_group_name = "{rg}"
location = var.location
sku {
name = "WAF_v2"
tier = "WAF_v2"
}
waf_configuration {
enabled = true
firewall_mode = "Prevention"
rule_set_version = "3.2"
}
# Configure gateway_ip_configuration, frontend, backend, etc.
}
Compliance frameworks
Is your environment compliant with this rule?
CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.
Related Azure rules
- Action Group should be enabled
- Activity Log Alert should be enabled
- AKS cluster logs should be sent to Log Analytics
- AKS cluster must enable RBAC
- AKS cluster must enable RBAC
- AKS cluster should be a private cluster
- AKS cluster should disable local accounts
- AKS cluster should enable Azure RBAC for Kubernetes