Blog Post

Azure Network Security Blog
6 MIN READ

Azure Web Application Firewall: WAF config versus WAF policy

camilamartins's avatar
camilamartins
Icon for Microsoft rankMicrosoft
Apr 16, 2021

What is Web Application Firewall (WAF) config?

WAF config is the built-in method to configure WAF on Azure Application Gateway, and it is local to each individual Azure Application Gateway resource. When you create an Azure Application Gateway with either the WAF or the WAF_v2 SKU, you will see a new item on the menu blade called "Web application firewall" that displays WAF configuration options. 

 

The biggest drawback of using WAF config is that not all WAF settings are displayed in the portal UI. For example, you cannot configure or manage custom rules in the portal: you must use PowerShell or Azure CLI for that. Additionally, WAF config is a setting within an Azure Application Gateway resource. For this reason, each WAF config must be managed individually, and its configuration applies globally for everything within that specific Azure Application Gateway resource. WAF config does not exist on Azure Front Door.

 

Image: WAF config on Azure Application Gateway

 

 

What is WAF policy?

WAF policy is a standalone resource type. It is not a built-in configuration within the Azure Application Gateway resource. A WAF policy is managed independently, and it can be attached to either Azure Application Gateway or Azure Front Door resources. When checking the "Web application firewall" option on the menu blade for Azure Application Gateway or Azure Front Door, you will notice that it simply displays a link to the attached WAF policy, rather than the full WAF configuration settings. 

 

A benefit of using WAF policy for Azure Application Gateway or Azure Front Door is that all generally available WAF settings exist in the portal UI, such as exclusions, custom rules, managed rules and more. You can configure and visualize the WAF policy settings in the portal, in addition to PowerShell and Azure CLI. Another useful benefit of WAF policy when it comes to Azure Application Gateway is that it offers more granularity in scope. You can associate a WAF policy at a global level by assigning it to an Azure Application Gateway resource, at a website level by assigning it to an HTTP listener, or even at a URI level by assigning it to a specific route path. For example, you could use a global WAF policy to apply the baseline security controls that meet your organization's security policy and attach it to all your Azure Application Gateways. From there, based on individual application needs, you can apply a different WAF policy that contains more (or less) strict security controls at a website level or at a URI level.

 

Would you like more information on different WAF policy association levels for Azure Application Gateway? Refer to our Azure Web Application Firewall (WAF) policy overview documentation.

 

Image: WAF policy on Azure Application Gateway

 

 

Image: WAF policy on Azure Front Door

 

 

 

What types of rules are available in Azure WAF?

 

1. Azure-managed rule sets

The Azure-managed rulesets for Azure WAF on Azure Application Gateway and Azure Front Door are based on OWASP ModSecurity Core Rule Set (CRS). This set of rules protect your web applications against most top 10 OWASP web application security threats, such as SQL injection and cross-site scripting. 

 

When using Azure WAF with Azure Application Gateway, you will see the managed rule sets represented as OWASP_3.2 (Preview), OWASP_3.1, OWASP_3.0, and OWASP_2.2.9. Here, the Azure WAF uses the anomaly scoring mode, which  means all rules in these rule sets are evaluated for each request, and the request is only blocked when the anomaly scoring threshold is reached.

 

When using Azure WAF with Azure Front Door, you will see the managed rule sets represented as Microsoft_DefaultRuleSet_1.1 and DefaultRuleSet_1.0. The Microsoft_DefaultRuleSet_1.1 rule set includes Microsoft-authored rules in addition to the rules based on OWASP ModSecurity CRS. In this case, Azure WAF uses the traditional mode, which means that as soon as there is a rule match the WAF stops processing all other subsequent rules.

 

More information on Azure-managed rule sets for Azure WAF on Azure Application Gateway 

More information on Azure-managed rule sets for Azure WAF on Azure Front Door

 

2. Bot protection rule sets

Bot protection rule sets provide safety against bots doing scraping, scanning, and looking for vulnerabilities in your web application. These rule sets are powered by our own Microsoft Threat Intelligence feed, which is used by multiple Azure services, including Azure Firewall and Microsoft Defender for Cloud.

 

When using Azure WAF with Azure Application Gateway, you will see the bot protection rule set represented as Microsoft_BotManagerRuleSet_0.1. This rule set can detect known bad bots based on IP reputation. 

 

When using Azure WAF with Azure Front Door, you will see the bot protection rule set represented as Microsoft_BotManagerRuleSet_1.0. This rule set can detect bad bots, good bots, and unknown bots based on IP reputation, user-agent headers, and other indicators that compose signatures managed by Microsoft.

 

More information on Bot protection rule set for Azure WAF on Azure Application Gateway

More information on Bot protection rule sets for Azure WAF on Azure Front Door

 

3. Custom rules

Azure WAF provides the ability to create custom rules. This allows you to either fine-tune your WAF policy or create rules with specific logic to address your unique application requirements. The rule conditions can be based on many variables, such as IPs, geolocation, request URIs, post arguments, and more. Custom rules can trigger based on a simple match for Azure WAF on Azure Application Gateway and Azure Front Door, or additionally, they can trigger based on rate-limiting thresholds for Azure WAF on Azure Front Door.

 

If you’d like to see some WAF custom rule examples, check out our blog post on Azure WAF Custom Rule Samples and Use Cases

More information on Custom rules for Azure WAF on Azure Application Gateway

More information on Custom rules for Azure WAF on Azure Front Door

 

What are the feature distinctions between WAF config and WAF policy?

As you can see based on the information we have shared this far, there are a few important differences between the capabilities of WAF depending on the associated resource type. You can consult these tables to get a quick comparison and make an informed decision when deploying Azure WAF.

 

In the table below, we’re sharing the feature availability on WAF config for Azure Application Gateway WAF and WAF_v2 SKUs.

 

WAF Config Features

WAF SKU

WAF_v2 SKU

OWASP_3.2 (Preview)

Unavailable

Available

OWASP_3.1

Unavailable

Available

OWASP_3.0

Available

Available

OWASP_2.2.9

Available

Available

Microsoft_BotManagerRuleSet_0.1

Unavailable

Available

Geo-Location Rules

Unavailable

Available

Per-Site Policy 

Unavailable

Available

Per-Uri Policy 

Unavailable

Available

 

In the table below, we are detailing the feature availability on WAF policy for Azure Application Gateway WAF_v2 and Azure Front Door. Note that WAF policy cannot be used with Azure Application Gateway WAF SKU.

 

WAF Policy Features

Azure Application Gateway (WAF_v2 SKU)

Azure Front Door

OWASP-Based Rule Set

Available

Available

Microsoft-Authored Rule Set

Unavailable

Available

Bot Protection Rule Set

Available

Available

Custom Rules with Geo-Location support

Available

Available

Custom Rules with Rate-Limiting support

Unavailable

Available

Per-Website WAF Policy 

Available

Available

Per-URI WAF Policy 

Available

Unavailable

 

Are there other key differences worth mentioning?

Here are a few more things to consider:

 

 

In this article, we provided a snapshot of the current Azure WAF feature set. We’d love to hear more from you. Feel free to leave comments below or let us know more about new features you need in our Microsoft Azure Feedback forum.

Updated Dec 16, 2021
Version 3.0
  • We are migrating from one generic WAF config to an application specific WAF Policy, as we have a bunch of rules disabled which we dont need disabled for other applications. This improves our security and enables us to do more fine grained blocking.

     

    I must say, the whole policy part is supported, but is not totally done in the Application Gateway. If you activate a WAF policy rule for an application, that one becomes the default for the gateway. The notification you get when linking it is a bit vague and doesnt explain if you get any downtime when saving or what is being done to the previous default. The Application Gateway will then state that policy is used for everything, which is not the case if you have multiple. Microsoft could improve on the UI here. At the end though this does work fine, and there seems to be no downtime. The settings, when viewed from the policies, are correct.

  • something to add to the differences list between APPGW WAF and AFD is the Bot Protection Rule Set, in AFD is v very customizable where you can enable/disable specific bots where within AppGW is all or none and possible the rule itself may be different.