Azure Application Gateway

Web Application Firewall (WAF)

The Azure Web Application Firewall (WAF) on Application Gateway provides centralized protection for your web applications from common exploits and vulnerabilities. WAF can detect and block malicious HTTP/S traffic, such as SQL injection attacks, cross-site scripting attacks, and more.

What is WAF?

A Web Application Firewall (WAF) is a security service that protects your web applications from common web exploits and vulnerabilities that could compromise application integrity or lead to data breaches. WAFs are differentiated from firewalls in that they operate at the application layer (Layer 7) of the OSI model, whereas traditional firewalls operate at lower layers of the network stack. WAFs can be placed in front of one or more web applications to inspect traffic. They help you to gain visibility into the HTTP/S traffic to and from your web application, and can also detect and block malicious HTTP/S requests. WAFs can be deployed as an on-premises appliance, or as a cloud-based service.

Key Features of Azure WAF

WAF Policies

WAF policies are the core of how Azure WAF operates. A WAF policy defines the rules and configurations that WAF applies to traffic. You can associate a WAF policy with a specific Application Gateway.

Tip: It's recommended to start with WAF in detection mode to observe the traffic and identify potential false positives before switching to prevention mode.

Configuring WAF

You can configure WAF through the Azure portal, Azure CLI, Azure PowerShell, or ARM templates.

Creating a WAF Policy:

  1. Navigate to the Azure portal and search for "Web Application Firewall (WAF)".
  2. Click "Create".
  3. Select your subscription, resource group, and region.
  4. Choose a policy name and select the WAF mode (Detection or Prevention).
  5. Choose the managed rule set (e.g., OWASP CRS 3.2).
  6. Configure custom rules and other settings as needed.
  7. Review and create the policy.

Associating a WAF Policy with Application Gateway:

You can associate an existing WAF policy with an Application Gateway during its creation or by editing an existing Application Gateway:

  1. Go to your Application Gateway resource in the Azure portal.
  2. In the left-hand menu, under "Settings", select "WAF".
  3. Click "Add WAF policy" or select an existing policy to associate.
  4. Save the changes.

WAF Modes

Managed Rule Sets

Azure WAF offers two primary managed rule sets:

Custom Rules

Custom rules allow you to define your own security logic:

Important: Regularly review your WAF logs and tune your custom rules to minimize false positives and ensure effective protection.

WAF and Application Gateway v1 vs v2

Azure WAF is available for both Application Gateway v1 and v2 SKUs, but v2 offers enhanced features and performance. It's recommended to use Application Gateway v2 for new deployments.

Further Reading