Review WAF protection for Azure Application Gateway

Configure both a WAF tier and an effective blocking policy for Application Gateway.

Description

standard_v2 does not provide a WAF. To inspect requests on Application Gateway, choose waf_v2 and attach an enabled WAF policy with the rules your application needs.

Potential impact

Unfiltered requests can reach the application. Application vulnerabilities still need to be fixed at their source.

Remediation

Set firewall_policy.id to the policy resource ID. If you need to block requests, set the policy to Prevention. Verify that its rules apply on the intended path and legitimate requests still pass.

Examples

Both tasks keep capacity at 2. The second changes the SKU name and tier and attaches the existing policy supplied through waf_policy_id. Provide listener and network settings separately.

Before

yaml
- name: Configure the Application Gateway
  azure.azcollection.azure_rm_appgateway:
    resource_group: myResourceGroup
    name: myAppGateway
    sku:
      name: standard_v2
      tier: standard_v2
      capacity: 2

After

yaml
- name: Configure the Application Gateway
  azure.azcollection.azure_rm_appgateway:
    resource_group: myResourceGroup
    name: myAppGateway
    sku:
      name: waf_v2
      tier: waf_v2
      capacity: 2
    firewall_policy:
      id: "{{ waf_policy_id }}"

References