Skip to content

Commit 6a3b801

Browse files
Front Door WAF documentation + ToC
1 parent 6405245 commit 6a3b801

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

articles/frontdoor/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
href: front-door-custom-domain-https.md
1818
- name: Set up a geo-filtering policy for your Front Door
1919
href: front-door-tutorial-geo-filtering.md
20+
- name: Web Application Firewall and Front Door
21+
href: front-door-waf.md
2022
- name: Samples
2123
items:
2224
- name: Resource Manager Templates

articles/frontdoor/front-door-waf.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: Quickly scale and protect a web application using Azure Front Door and Azure Web Application Firewall (WAF) | Microsoft Docs
3+
description: This article helps you understand how to use Web Application Firewall with your AAzure Front Door Service
4+
services: frontdoor
5+
documentationcenter: ''
6+
author: tremansdoerfer
7+
ms.service: frontdoor
8+
ms.devlang: na
9+
ms.topic: article
10+
ms.tgt_pltfrm: na
11+
ms.workload: infrastructure-services
12+
ms.date: 04/30/2029
13+
ms.author: tremansdoerfer
14+
15+
// Application Gateway -- (How-to)
16+
// Assign teresa as reviewer
17+
---
18+
19+
// Add to tutorial part under Front Door Documentation
20+
21+
# Quickly scale and protect a web application using Azure Front Door and Azure Web Application Firewall (WAF)
22+
23+
Many web applications have experienced rapid increase of traffic in recent weeks related to Covid 19. In addition, these web applications are also observing a surge in malicious traffic including denial of service attacks. An effective way to handle both these needs, scale out for traffic surges and protect from attacks, is to setup Azure Front Door with Azure WAF as an acceleration, caching and security layer in front of your web application. This article provides guidance on how to quickly get this Azure Front Door with Azure WAF setup for any web applications running in or outside of Azure.
24+
25+
We will be using Azure CLI to set this up in this tutorial, but all these steps are also fully supported in Azure Portal, Azure PowerShell, Azure ARM and Azure REST APIs.
26+
27+
### Prerequisites
28+
29+
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
30+
31+
The instructions in this blog use the Azure Command Line Interface (CLI). Please visit this guide to [get started with Azure CLI](https://docs.microsoft.com/cli/azure/get-started-with-azure-cli?view=azure-cli-latest).
32+
33+
*Tip: an easy & quick way to get started on Azure CLI is with [Bash in Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/quickstart)*
34+
35+
Ensure that the front-door extension is added to your Azure CLI
36+
37+
```azurecli-interactive
38+
az extension add --name front-door
39+
```
40+
41+
Note: For more details of the commands listed below, please refer to the [Azure CLI reference for Front Door](https://docs.microsoft.com/cli/azure/ext/front-door/?view=azure-cli-latest).
42+
43+
### Step 1: Create an Azure Front Door (AFD) resource
44+
45+
46+
```azurecli-interactive
47+
az network front-door create --backend-address <> --accepted-protocols <> --name <> --resource-group <>
48+
```
49+
50+
**--backend-address**: This is the Fully Qualified Domain Name (FQDN) name of the application you want to protect. For example myapplication.contoso.com
51+
52+
**--accepted-protocols**: This specifies what all protocols you want AFD to support for your web application. An example would be --accepted-protocols Http Https.
53+
54+
**--name**: Specify a name for your AFD resource
55+
56+
**--resource-group**: The resource group you want to place this AFD resource in. To learn more about resource groups, please visit manage resource groups in Azure
57+
58+
In the response you get from successfully executing this command, look for the key "hostName" and note down its value to be used in a later step. This is the DNS name of the AFD resource you had just created
59+
60+
### Step 2: Create an Azure WAF profile to use with Azure Front Door resources
61+
62+
```azurecli-interactive
63+
az network front-door waf-policy create --name <> --resource-group <> --disabled false --mode Prevention
64+
```
65+
66+
--name Specify a name for your Azure WAF policy
67+
68+
--resource-group The resource group you want to place this WAF resource in.
69+
70+
This will create a WAF policy which is enabled and is in the Prevention mode.
71+
72+
Note: you may also want to create the WAF in Detection mode and observe how it is detecting & logging malicious requests (and not blocking) before deciding to change to Protection mode.
73+
74+
In the response you get from successfully executing this command, look for the key "id" and note down its value to be used in a later step. This should be in the format
75+
76+
/subscriptions/**subscription id**/resourcegroups/**resource group name**/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/**WAF policy name**
77+
78+
### Step 3: Add managed rulesets to this WAF policy
79+
80+
In a WAF policy you can add managed rulesets which are a sets of rules built and managed by Microsoft and gives out of the box protection against entire classes of threats. In this example, we are adding two such rulesets (1) Default ruleset that protects against common web threats and (2) Bot protection ruleset which protects against malicious bots
81+
82+
(1) Add the default ruleset
83+
84+
```azurecli-interactive
85+
az network front-door waf-policy managed-rules add --policy-name <> --resource-group <> --type DefaultRuleSet --version 1.0
86+
```
87+
88+
(2) Add the bot manager ruleset
89+
90+
```azurecli-interactive
91+
az network front-door waf-policy managed-rules add --policy-name <> --resource-group <> --type Microsoft_BotManagerRuleSet --version 1.0
92+
```
93+
94+
--policy-name The name you gave for your Azure WAF resource
95+
96+
--resource-group The resource group you had placed this WAF resource in.
97+
98+
### Step 4: Associate the WAF policy with the AFD resource
99+
100+
In this step we will be associating the WAF policy we have built with the AFD resource that is in front of your web application.
101+
102+
```azurecli-interactive
103+
az network front-door update --name <> --resource-group <> --set frontendEndpoints[0].webApplicationFirewallPolicyLink='{"id":"<>"}'
104+
```
105+
106+
--name The name you had specified for your AFD resource
107+
108+
--resource-group The resource group you had placed the Azure Front Door resource in.
109+
110+
--set This is where you update the attribute WebApplicationFirewallPolicyLink for the frontendEndpoint associated with your AFD resource with the newly built WAF policy. The id of the WAF policy can be found from the response you got from step #2 above
111+
112+
Note: the above example is for the case where you are not using a custom domain, if you are
113+
114+
If you are not using any custom domains to access your web applications, you can skip step #5. In that case, you will be providing to your end users the hostname you obtained in step #1 to navigate to your web application
115+
116+
### Step 5: Configure custom domain for your web application
117+
118+
Initially the custom domain name of your web application (the one that customers use to refer to your application, e.g. www.contoso.com) was pointing towards the place where you had it running before AFD was introduced. After this change of architecture adding AFD+WAF to front the application, the DNS entry corresponding to that custom domain should now point to this AFD resource. This can be done by re-mapping this entry in your DNS server to the AFD hostname you had noted in step #1.
119+
120+
Specific steps to do this will depend on your DNS service provider, but if you are using Azure DNS to host your DNS name, you can refer to the documentation for [steps do update a DNS record](https://docs.microsoft.com/azure/dns/dns-operations-recordsets-cli) and point to the AFD hostName.
121+
122+
One key thing to note here is that, if you need your users to navigate to your website using the zone apex, e.g. contoso.com, you have to use Azure DNS and it's [ALIAS record type](https://docs.microsoft.com/azure/dns/dns-alias) to host your DNS name.
123+
124+
In addition, you also need to update your AFD configuration to [add this custom domain](https://docs.microsoft.com/azure/frontdoor/front-door-custom-domain) to it so that AFD understands this mapping.
125+
126+
Finally, if you are using a custom domain to reach your web application and want to enable the HTTPS protocol, you need to have the [certificates for your custom domain setup in AFD](https://docs.microsoft.com/azure/frontdoor/front-door-custom-domain-https).
127+
128+
### Step 6: Lockdown your web application
129+
130+
One optional best practice to follow is to ensure that only AFD edges can communicate with your web application. This will ensure that no one can bypass the AFD protections and access your applications directly. You can accomplish this lockdown by visiting the [FAQ section of AFD](https://docs.microsoft.com/azure/frontdoor/front-door-faq) and referring to the question regarding locking down backends for access only by AFD.

0 commit comments

Comments
 (0)