Tutorial: Create a Web Application Firewall policy on Azure Front Door using the Azure portal
This tutorial shows you how to create a basic Azure Web Application Firewall (WAF) policy and apply it to a front-end host at Azure Front Door.
In this tutorial, you learn how to:
- Create a WAF policy
- Associate it with a frontend host
- Configure WAF rules
Create a Web Application Firewall policy
First, create a basic WAF policy with managed Default Rule Set (DRS) by using the portal.
On the top left-hand side of the screen, select Create a resource > search for WAF > select Web Application Firewall (WAF) > select Create.
In the Basics tab of the Create a WAF policy page, enter or select the following information, accept the defaults for the remaining settings, and then select Review + create:
Setting Value Policy for Select Global WAF (Front Door). Front Door SKU Select between basic, standard and premium SKU. Subscription Select your Front Door subscription name. Resource group Select your Front Door resource group name. Policy name Enter a unique name for your WAF policy. Policy state Set as Enabled.
In the Association tab of the Create a WAF policy page, select + Associate a Front Door profile, enter the following settings, and then select Add:
Setting Value Front door profile Select your Front Door profile name. Domains Select the domains you want to associate the WAF policy to, then select Add.
If the domain is associated to a WAF policy, it is shown as grayed out. You must first remove the domain from the associated policy, and then re-associate the domain to a new WAF policy.
Select Review + create, then select Create.
Configure Web Application Firewall rules (optional)
When you create a WAF policy, by the default WAF policy is in Detection mode. In Detection mode, WAF does not block any requests, instead, requests matching the WAF rules are logged at WAF logs. To see WAF in action, you can change the mode settings from Detection to Prevention. In Prevention mode, requests that match rules that are defined in Default Rule Set (DRS) are blocked and logged at WAF logs.
You can create a custom rule by selecting Add custom rule under the Custom rules section. This launches the custom rule configuration page.
Below is an example of configuring a custom rule to block a request if the query string contains blockme.
Default Rule Set (DRS)
Azure-managed Default Rule Set is enabled by default. Current default version is DefaultRuleSet_1.0. From WAF Managed rules, Assign, recently available ruleset Microsoft_DefaultRuleSet_1.1 is available in the drop down list.
To disable an individual rule, select the check box in front of the rule number, and select Disable at the top of the page. To change actions types for individual rules within the rule set, select the check box in front of the rule number, and then select the Change action at the top of the page.
Clean up resources
When no longer needed, remove the resource group and all related resources.