Create Web Application Firewall (WAF) policies for Application Gateway (2024)

  • Article

Associating a WAF policy with listeners allows for multiple sites behind a single WAF to be protected by different policies. For example, if there are five sites behind your WAF, you can have five separate WAF policies (one for each listener) to customize the exclusions, custom rules, and managed rulesets for one site without effecting the other four. If you want a single policy to apply to all sites, you can just associate the policy with the Application Gateway, rather than the individual listeners, to make it apply globally. Policies can also be applied to a path-based routing rule.

You can make as many policies as you want. Once you create a policy, it must be associated to an Application Gateway to go into effect, but it can be associated with any combination of Application Gateways and listeners.

If your Application Gateway has an associated policy, and then you associate a different policy to a listener on that Application Gateway, the listener's policy takes effect, but just for the listener(s) that they're assigned to. The Application Gateway policy still applies to all other listeners that don't have a specific policy assigned to them.

Note

Once a Firewall Policy is associated to a WAF, there must always be a policy associated to that WAF. You may overwrite that policy, but disassociating a policy from the WAF entirely isn't supported.

All new Web Application Firewall's WAF settings (custom rules, managed ruleset configurations, exclusions, etc.) live inside of a WAF Policy. If you have an existing WAF, these settings may still exist in your WAF config. For steps on how to move to the new WAF Policy, see Upgrade your WAF Config to a WAF Policy later in this article.

WAF policies need to be in the enabled state to inspect request traffic, log events and take action on requests. WAF policies in detection mode will log events when WAF rules are triggered but won't take any other action. Policies in prevention mode will take action on requests as well as log the event in the logs.

Create a policy

First, create a basic WAF policy with a managed Default Rule Set (DRS) using the Azure portal.

  1. On the upper left side of the portal, select Create a resource. Search for WAF, select Web Application Firewall, then select Create.

  2. On Create a WAF policy page, Basics tab, enter or select the following information and accept the defaults for the remaining settings:

    SettingValue
    Policy forRegional WAF (Application Gateway)
    SubscriptionSelect your subscription name
    Resource groupSelect your resource group
    Policy nameType a unique name for your WAF policy.
  3. On the Association tab, select Add association, then select one of the following settings:

    SettingValue
    Application GatewaySelect the application gateway, and then select Add.
    HTTP ListenerSelect the application gateway, select the listeners, then select Add.
    Route PathSelect the application gateway, select the listener, select the routing rule, and then select Add.

    Note

    If you assign a policy to your Application Gateway (or listener) that already has a policy in place, the original policy is overwritten and replaced by the new policy.

  4. Select Review + create, then select Create.

    Create Web Application Firewall (WAF) policies for Application Gateway (1)

Configure WAF rules (optional)

When you create a WAF policy, by default it is in Detection mode. In Detection mode, WAF doesn't block any requests. Instead, the matching WAF rules are logged in the WAF logs. To see WAF in action, you can change the mode settings to Prevention. In Prevention mode, matching rules defined in the Microsoft Managed Rulesets you selected are blocked and/or logged in the WAF logs.

Managed rules

Azure-managed OWASP rules are enabled by default. To disable an individual rule within a rule group, expand the rules within that rule group, select the check box in front of the rule number, and select Disable on the tab above.

Custom rules

To create a custom rule, select Add custom rule under the Custom rules tab. This opens the custom rule configuration page. The following screenshot shows an example custom rule configured to block a request if the query string contains the text blockme.

Upgrade your WAF Config to a WAF Policy

If you have an existing WAF, you may have noticed some changes in the portal. First you need to identify what kind of Policy you've enabled on your WAF. There are three potential states:

  1. No WAF Policy
  2. Custom Rules only Policy
  3. WAF Policy

You can tell which state your WAF is in by looking at it in the portal. If the WAF settings are visible and can be changed from within the Application Gateway view, your WAF is in state 1.

If you select Web Application Firewall and it shows you an associated policy, the WAF is in state 2 or state 3. After navigating to the policy, if it shows only custom rules, and Associated Application Gateways, then it's a Custom Rules only Policy.

Create Web Application Firewall (WAF) policies for Application Gateway (5)

If it also shows Policy Settings and Managed Rules, then it's a full Web Application Firewall policy.

Create Web Application Firewall (WAF) policies for Application Gateway (6)

Upgrade to WAF Policy

If you have a Custom Rules only WAF Policy, then you may want to move to the new WAF Policy. Going forward, the firewall policy supports WAF policy settings, managed rulesets, exclusions, and disabled rule-groups. Essentially, all the WAF configurations that were previously done inside the Application Gateway are now done through the WAF Policy.

Edits to the custom rule only WAF policy are disabled. To edit any WAF settings such as disabling rules, adding exclusions, etc. you have to upgrade to a new top-level firewall policy resource.

To do so, create a Web Application Firewall Policy and associate it to your Application Gateway(s) and listener(s) of choice. This new Policy must be exactly the same as the current WAF config, meaning every custom rule, exclusion, disabled rule, etc. must be copied into the new Policy you're creating. Once you have a Policy associated with your Application Gateway, then you can continue to make changes to your WAF rules and settings. You can also do this with Azure PowerShell. For more information, see Associate a WAF policy with an existing Application Gateway.

Optionally, you can use a migration script to upgrade to a WAF policy. For more information, see Upgrade Web Application Firewall policies using Azure PowerShell.

Force mode

If you don't want to copy everything into a policy that is exactly the same as your current config, you can set the WAF into "force" mode. Run the following Azure PowerShell code to put your WAF in force mode. Then you can associate any WAF Policy to your WAF, even if it doesn't have the exact same settings as your config.

$appgw = Get-AzApplicationGateway -Name <your Application Gateway name> -ResourceGroupName <your Resource Group name>$appgw.ForceFirewallPolicyAssociation = $true

Then proceed with the steps to associate a WAF Policy to your application gateway. For more information, see Associate a WAF Policy with an existing Application Gateway.

Next steps

Learn more about Web Application Firewall CRS rule groups and rules.

Create Web Application Firewall (WAF) policies for Application Gateway (2024)
Top Articles
A Lightweight Material Stronger than Steel
How to get Arceus in Pokémon Legends Arceus: all requirements
AMC Theatre - Rent A Private Theatre (Up to 20 Guests) From $99+ (Select Theaters)
Craigslist Benton Harbor Michigan
Prosper TX Visitors Guide - Dallas Fort Worth Guide
The Realcaca Girl Leaked
The Pope's Exorcist Showtimes Near Cinemark Hollywood Movies 20
Call of Duty: NEXT Event Intel, How to Watch, and Tune In Rewards
Natureza e Qualidade de Produtos - Gestão da Qualidade
Blue Ridge Now Mugshots Hendersonville Nc
Phillies Espn Schedule
Synq3 Reviews
Facebook Marketplace Charlottesville
Nj Scratch Off Remaining Prizes
Assets | HIVO Support
Sports Clips Plant City
UEQ - User Experience Questionnaire: UX Testing schnell und einfach
Void Touched Curio
Lima Funeral Home Bristol Ri Obituaries
Dtab Customs
Craigslist In Visalia California
Days Until Oct 8
Best Mechanics Near You - Brake Masters Auto Repair Shops
How your diet could help combat climate change in 2019 | CNN
Kirk Franklin Mother Debra Jones Age
Meet the Characters of Disney’s ‘Moana’
Marilyn Seipt Obituary
By.association.only - Watsonville - Book Online - Prices, Reviews, Photos
Toonkor211
Autopsy, Grave Rating, and Corpse Guide in Graveyard Keeper
Here’s how you can get a foot detox at home!
Blackstone Launchpad Ucf
Metro 72 Hour Extension 2022
Domino's Delivery Pizza
Frank 26 Forum
Linda Sublette Actress
Top 25 E-Commerce Companies Using FedEx
Prior Authorization Requirements for Health Insurance Marketplace
The Conners Season 5 Wiki
Bekah Birdsall Measurements
Citroen | Skąd pobrać program do lexia diagbox?
Mother Cabrini, the First American Saint of the Catholic Church
Stitch And Angel Tattoo Black And White
The Bold and the Beautiful
Sam's Club Gas Price Sioux City
What your eye doctor knows about your health
sin city jili
Grace Charis Shagmag
Haunted Mansion Showtimes Near The Grand 14 - Ambassador
7 National Titles Forum
Equinox Great Neck Class Schedule
Latest Posts
Article information

Author: Jerrold Considine

Last Updated:

Views: 6382

Rating: 4.8 / 5 (58 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Jerrold Considine

Birthday: 1993-11-03

Address: Suite 447 3463 Marybelle Circles, New Marlin, AL 20765

Phone: +5816749283868

Job: Sales Executive

Hobby: Air sports, Sand art, Electronics, LARPing, Baseball, Book restoration, Puzzles

Introduction: My name is Jerrold Considine, I am a combative, cheerful, encouraging, happy, enthusiastic, funny, kind person who loves writing and wants to share my knowledge and understanding with you.