Skip to content

Commit d4deb75

Browse files
authored
Merge pull request #303599 from ShawnJackson/web-application-firewall-on-application-gateway-for-containers
[AQ] edit pass: Articles about Web Application Firewall on Application Gateway for Containers
2 parents 4f10c8e + e13bd19 commit d4deb75

File tree

3 files changed

+105
-100
lines changed

3 files changed

+105
-100
lines changed

articles/application-gateway/for-containers/how-to-waf-gateway-api.md

Lines changed: 75 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Web Application Firewall on Application Gateway for Containers - Gateway API
3-
description: This document provides an example scenario for testing the Web Application Firewall (WAF) on Application Gateway for Containers.
2+
title: Azure Web Application Firewall on Application Gateway for Containers - Gateway API
3+
description: This article provides an example scenario for testing Azure Web Application Firewall on Application Gateway for Containers.
44
services: application-gateway
55
author: jackstromberg
66
ms.service: azure-appgw-for-containers
@@ -9,42 +9,46 @@ ms.date: 7/21/2025
99
ms.author: jstrom
1010
---
1111

12-
# Web Application Firewall on Application Gateway for Containers with Gateway API
12+
# Azure Web Application Firewall on Application Gateway for Containers with the Gateway API
1313

14-
This document helps set up an example application that uses the following resources from Gateway API. Steps are provided to:
14+
This article helps you set up an example application that uses resources from the Gateway API. The article provides steps to:
1515

16-
- Create a [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) resource with one HTTPS listener.
17-
- Create an [HTTPRoute](https://gateway-api.sigs.k8s.io/api-types/httproute) that references a backend service.
18-
- Create a `WebApplicationFirewallPolicy` resource that references an HTTPRoute.
16+
- Create a [`Gateway`](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) resource with one HTTPS listener.
17+
- Create an [`HTTPRoute`](https://gateway-api.sigs.k8s.io/api-types/httproute) resource that references a back-end service.
18+
- Create a `WebApplicationFirewallPolicy` resource that references an `HTTPRoute` resource.
1919

2020
## Background
2121

22-
Application Gateway for Containers leverages web application firewall to block a malicious request from being proxied to the backend target. See the following example scenario:
22+
Application Gateway for Containers uses Azure Web Application Firewall to block a malicious request from being proxied to the back-end target. The following diagram shows an example scenario.
2323

24-
![A figure showing a malicious request being blocked by Application Gateway for Containers with Web Application Firewall enabled in prevention mode.](./media/how-to-web-application-firewall-gateway-api/web-application-firewall.png)
24+
![Diagram that shows a malicious request being blocked by Application Gateway for Containers with Azure Web Application Firewall enabled in prevention mode.](./media/how-to-web-application-firewall-gateway-api/web-application-firewall.png)
2525

2626
## Prerequisites
2727

28-
1. If following the BYO deployment strategy, ensure you have set up your Application Gateway for Containers resources and [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md)
29-
2. If following the ALB managed deployment strategy, ensure you have provisioned your [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md) and provisioned the Application Gateway for Containers resources via the [ApplicationLoadBalancer custom resource](quickstart-create-application-gateway-for-containers-managed-by-alb-controller.md).
30-
3. Deploy sample HTTP application
31-
Apply the following deployment.yaml file on your cluster to create a sample web application to demonstrate the header rewrite.
28+
- If you're following the bring-your-own (BYO) deployment strategy, ensure that you set up your Application Gateway for Containers resources and [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md).
3229

33-
```bash
34-
kubectl apply -f https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/refs/heads/main/articles/application-gateway/for-containers/examples/traffic-split-scenario/deployment.yaml
35-
```
30+
- If you're following the Application Load Balancer (ALB) managed deployment strategy, ensure that you:
31+
32+
- Provisioned your [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md).
33+
- Provisioned the Application Gateway for Containers resources via the [`ApplicationLoadBalancer` custom resource](quickstart-create-application-gateway-for-containers-managed-by-alb-controller.md).
34+
35+
- Apply the following `deployment.yaml` file on your cluster to create a sample web application that demonstrates the header rewrite:
36+
37+
```bash
38+
kubectl apply -f https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/refs/heads/main/articles/application-gateway/for-containers/examples/traffic-split-scenario/deployment.yaml
39+
```
3640

37-
This command creates the following on your cluster:
41+
This command creates the following items on your cluster:
3842

39-
- a namespace called `test-infra`
40-
- two services called `backend-v1` and `backend-v2` in the `test-infra` namespace
41-
- two deployments called `backend-v1` and `backend-v2` in the `test-infra` namespace
43+
- A namespace called `test-infra`
44+
- Two services called `backend-v1` and `backend-v2` in the `test-infra` namespace
45+
- Two deployments called `backend-v1` and `backend-v2` in the `test-infra` namespace
4246

4347
## Deploy the required Gateway API resources
4448

4549
# [ALB managed deployment](#tab/alb-managed)
4650

47-
Create a gateway:
51+
Create a `Gateway` resource:
4852

4953
```bash
5054
kubectl apply -f - <<EOF
@@ -70,53 +74,53 @@ EOF
7074

7175
[!INCLUDE [application-gateway-for-containers-frontend-naming](../../../includes/application-gateway-for-containers-frontend-naming.md)]
7276

73-
# [Bring your own (BYO) deployment](#tab/byo)
77+
# [BYO deployment](#tab/byo)
7478

75-
1. Set the following environment variables
79+
1. Set the following environment variables:
7680

77-
```bash
78-
RESOURCE_GROUP='<resource group name of the Application Gateway For Containers resource>'
79-
RESOURCE_NAME='alb-test'
80-
81-
RESOURCE_ID=$(az network alb show --resource-group $RESOURCE_GROUP --name $RESOURCE_NAME --query id -o tsv)
82-
FRONTEND_NAME='frontend'
83-
```
81+
```bash
82+
RESOURCE_GROUP='<resource group name of the Application Gateway For Containers resource>'
83+
RESOURCE_NAME='alb-test'
84+
85+
RESOURCE_ID=$(az network alb show --resource-group $RESOURCE_GROUP --name $RESOURCE_NAME --query id -o tsv)
86+
FRONTEND_NAME='frontend'
87+
```
8488

85-
2. Create a Gateway
89+
2. Create a `Gateway` resource:
8690

87-
```bash
88-
kubectl apply -f - <<EOF
89-
apiVersion: gateway.networking.k8s.io/v1
90-
kind: Gateway
91-
metadata:
92-
name: gateway-01
93-
namespace: test-infra
94-
annotations:
95-
alb.networking.azure.io/alb-id: $RESOURCE_ID
96-
spec:
97-
gatewayClassName: azure-alb-external
98-
listeners:
99-
- name: http-listener
100-
port: 80
101-
protocol: HTTP
102-
allowedRoutes:
103-
namespaces:
104-
from: Same
105-
addresses:
106-
- type: alb.networking.azure.io/alb-frontend
107-
value: $FRONTEND_NAME
108-
EOF
109-
```
91+
```bash
92+
kubectl apply -f - <<EOF
93+
apiVersion: gateway.networking.k8s.io/v1
94+
kind: Gateway
95+
metadata:
96+
name: gateway-01
97+
namespace: test-infra
98+
annotations:
99+
alb.networking.azure.io/alb-id: $RESOURCE_ID
100+
spec:
101+
gatewayClassName: azure-alb-external
102+
listeners:
103+
- name: http-listener
104+
port: 80
105+
protocol: HTTP
106+
allowedRoutes:
107+
namespaces:
108+
from: Same
109+
addresses:
110+
- type: alb.networking.azure.io/alb-frontend
111+
value: $FRONTEND_NAME
112+
EOF
113+
```
110114
111115
---
112116
113-
Once the gateway resource is created, ensure the status is valid, the listener is _Programmed_, and an address is assigned to the gateway.
117+
After you create the `Gateway` resource, ensure that the status is valid, the listener has a status of `Programmed`, and an address is assigned to it:
114118
115119
```bash
116120
kubectl get gateway gateway-01 -n test-infra -o yaml
117121
```
118122
119-
Example output of successful gateway creation.
123+
Here's example output for successful creation of a `Gateway` resource:
120124
121125
```yaml
122126
status:
@@ -163,7 +167,7 @@ status:
163167
kind: HTTPRoute
164168
```
165169
166-
Once the gateway is created, create an HTTPRoute that listens for hostname contoso.com.
170+
Create an `HTTPRoute` resource that listens for the host name `contoso.com`:
167171
168172
```bash
169173
kubectl apply -f - <<EOF
@@ -185,13 +189,13 @@ spec:
185189
EOF
186190
```
187191
188-
Once the HTTPRoute resource is created, ensure the route is _Accepted_ and the Application Gateway for Containers resource is _Programmed_.
192+
After you create the `HTTPRoute` resource, ensure that the status of the route is `Accepted` and the status of the Application Gateway for Containers resource is `Programmed`:
189193
190194
```bash
191195
kubectl get httproute header-rewrite-route -n test-infra -o yaml
192196
```
193197
194-
Verify the status of the Application Gateway for Containers resource has been successfully updated.
198+
Verify that the status of the Application Gateway for Containers resource was successfully updated:
195199
196200
```yaml
197201
status:
@@ -225,7 +229,7 @@ status:
225229
226230
### Configure WebApplicationFirewallPolicy
227231
228-
Application Gateway for Containers uses a custom resource called `WebApplicationFirewallPolicy` to define WAF protection. In this example, WAF will protect a specific HTTPRoute.
232+
Application Gateway for Containers uses a custom resource called `WebApplicationFirewallPolicy` to define Azure Web Application Firewall protection. In this example, Azure Web Application Firewall helps protect a specific `HTTPRoute` resource:
229233
230234
```bash
231235
kubectl apply -f - <<EOF
@@ -240,12 +244,13 @@ spec:
240244
kind: HTTPRoute
241245
name: contoso-waf-route
242246
namespace: test-infra
243-
#sectionNames: ["listenerA"] # defined if targeting a specific listener on a gateway resource or path
247+
#sectionNames: ["listenerA"] # defined if you're targeting a specific listener on a gateway resource or path
244248
webApplicationFirewall:
245249
id: /subscriptions/.../Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/waf-policy-0
246250
EOF
247251
```
248252
253+
```bash
249254
kubectl apply -f - <<EOF
250255
apiVersion: alb.networking.azure.io/v1
251256
kind: WebApplicationFirewallPolicy
@@ -258,27 +263,28 @@ spec:
258263
kind: HTTPRoute
259264
name: contoso-waf-route
260265
namespace: test-infra
261-
#sectionNames: ["listenerA"] # defined if targeting a specific listener on a gateway resource or path
266+
#sectionNames: ["listenerA"] # defined if you're targeting a specific listener on a gateway resource or path
262267
webApplicationFirewall:
263268
id: /subscriptions/711d99a7-fd79-4ce7-9831-ea1afa18442e/resourceGroups/AGC-RG/providers/Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/agc-waf
264269
EOF
270+
```
265271
266272
## Test access to the application
267273
268-
Now we're ready to send some traffic to our sample application, via the FQDN assigned to the frontend. Use the following command to get the FQDN:
274+
Now you're ready to send some traffic to the sample application, via the fully qualified domain name (FQDN) assigned to the frontend resource. Use the following command to get the FQDN:
269275
270276
```bash
271277
fqdn=$(kubectl get gateway gateway-01 -n test-infra -o jsonpath='{.status.addresses[0].value}')
272278
```
273279
274-
If you specify the server name indicator using the curl command, `contoso.com` for the frontend FQDN, the output should return a response from the backend-v1 service.
280+
If you specify the server name indicator by using the `curl` command, with `contoso.com` for the frontend resource's FQDN, the output should return a response from the `backend-v1` service:
275281
276282
```bash
277283
fqdnIp=$(dig +short $fqdn)
278284
curl -k --resolve contoso.com:80:$fqdnIp http://contoso.com
279285
```
280286
281-
Via the response we should see:
287+
Via the response, you should see:
282288
283289
```json
284290
{
@@ -310,18 +316,18 @@ Via the response we should see:
310316
}
311317
```
312318
313-
Now, send a request with a malicious query string to trigger a `403 forbidden` response from your Application Gateway for Containers.
319+
Now, send a request with a malicious query string to trigger a `403 forbidden` response from Application Gateway for Containers.
314320
315-
**Example 1:**
321+
Here's one example request:
316322
317323
```bash
318324
curl -k --resolve contoso.com:80:$fqdnIp http://contoso.com/?text=/etc/passwd
319325
```
320326
321-
**Example 2:**
327+
Here's another example request:
322328
323329
```bash
324330
curl -k --resolve contoso.com:80:$fqdnIp http://contoso.com/?1=1=1
325331
```
326332
327-
Congratulations, you have installed ALB Controller, deployed a backend application and used Web Application Firewall functionality to block a malicious request.
333+
Congratulations! You installed an ALB Controller, deployed a back-end application, and used Azure Web Application Firewall functionality to block a malicious request.
Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
---
2-
title: Web Application Firewall on Application Gateway for Containers
3-
description: This page provides an overview of the Web Application Firewall (WAF) on Application Gateway for Containers, including setup, limitations, known issues, and more.
2+
title: Azure Web Application Firewall on Application Gateway for Containers
3+
description: This article provides an overview of Azure Web Application Firewall on Application Gateway for Containers, including setup, limitations, and pricing.
44
services: application-gateway
55
author: jackstromberg
66
ms.service: azure-appgw-for-containers
7-
ms.topic: how-to
7+
ms.topic: concept-article
88
ms.date: 7/22/2025
99
ms.author: jstrom
1010
---
1111

12-
# Web Application Firewall on Application Gateway for Containers
12+
# Azure Web Application Firewall on Application Gateway for Containers
1313

14-
Web Application Firewall (WAF) provides centralized protection of your web applications from common exploits and vulnerabilities. All WAF functionality exists inside of a WAF policy, which can be referenced at listener or path-based routing rules within Gateway API yaml configuration.
14+
Azure Web Application Firewall provides centralized protection of your web applications from common exploits and vulnerabilities. All Azure Web Application Firewall functionality exists inside a policy, which can be referenced at listener or path-based routing rules within the Gateway API YAML configuration.
1515

16-
![Diagram depicting a request being blocked by a web application firewall rule.](./media/how-to-web-application-firewall-gateway-api/web-application-firewall.png)
16+
![Diagram that shows an Azure Web Application Firewall rule blocking a request.](./media/how-to-web-application-firewall-gateway-api/web-application-firewall.png)
1717

1818
## Application Gateway for Containers implementation
1919

20-
### Security Policy
20+
### Security policy
2121

22-
Application Gateway for Containers introduces a new child resource in Azure Resource Manager (ARM), called a SecurityPolicy. The SecurityPolicy is what brings scope to which WAF policies may be referenced by the ALB Controller.
22+
Application Gateway for Containers introduces a new child resource called `SecurityPolicy` in Azure Resource Manager. The `SecurityPolicy` resource brings scope to which Azure Web Application Firewall policies the ALB Controller can reference.
2323

24-
### Kubernetes Custom Resource
24+
### Kubernetes custom resource
2525

26-
Application Gateway for Containers introduces a new custom resource called `WebApplicationFirewallPolicy`. The custom resource is responsible for defining which WAF Policy should be used at which scope.
26+
Application Gateway for Containers introduces a new custom resource called `WebApplicationFirewallPolicy`. The custom resource is responsible for defining which Azure Web Application Firewall policy should be used at which scope.
2727

28-
The following scopes may be defined:
28+
The resource can define the following scopes:
2929

30-
* Gateway
31-
* HTTPRoute
30+
* `Gateway`
31+
* `HTTPRoute`
3232

33-
In addition, the following sections may be referenced by name for each of the parent resources:
33+
In addition, the resource can reference the following sections by name for each of the parent resources:
3434

35-
* Gateway - Listener
36-
* HTTPRoute - Path
35+
* `Gateway`: `Listener`
36+
* `HTTPRoute`: `Path`
3737

38-
Here is an example YAML configuration that shows targeting a specific path called `pathA` on an HTTPRoute resource:
38+
Here's an example YAML configuration that shows targeting a specific path called `pathA` on an `HTTPRoute` resource:
3939

4040
```yaml
4141
apiVersion: alb.networking.azure.io/v1
@@ -56,23 +56,22 @@ spec:
5656
5757
## Limitations
5858
59-
The following functionality is not supported on a WAF Policy associated with Application Gateway for Containers:
59+
The following functionality is not supported on an Azure Web Application Firewall policy that's associated with Application Gateway for Containers:
6060
61-
* WAF Security Copilot
62-
* JavaScript (JS) Challenge Actions
63-
* CRS 3.2 and lower ruleset
61+
* Azure Web Application Firewall integration in Microsoft Security Copilot
62+
* JavaScript challenge actions
63+
* Core Rule Set (CRS) 3.2 and earlier rule sets
6464
6565
## Pricing
6666
67-
WAF is incrementally billed in addition to Application Gateway for Containers. Two meters track WAF consumption:
67+
Azure Web Application Firewall is incrementally billed in addition to Application Gateway for Containers. Two metrics track Azure Web Application Firewall consumption:
6868
69-
* AGC WAF Hour
70-
* AGC 1M WAF Requests
69+
* `AGC WAF Hour`
70+
* `AGC 1M WAF Requests`
7171

72-
An AGC WAF Hour is incurred for the duration a security policy has a WAF policy referenced.
72+
An `AGC WAF Hour` rate is incurred for the duration that a security policy references an Azure Web Application Firewall policy.
7373

74-
As each request is processed by WAF rules or Bot Protection, a consumption rate is billed per 1 million requests.
74+
As Azure Web Application Firewall rules or bot protection processes each request, a consumption rate is billed per 1 million requests.
7575

7676
> [!NOTE]
77-
> Application Gateway for Containers + WAF is in PREVIEW.
78-
> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
77+
> The association of Application Gateway for Containers with Azure Web Application Firewall is in preview. For legal terms that apply to Azure features that are in beta, in preview, or otherwise not yet released into general availability, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).

includes/application-gateway-for-containers-frontend-naming.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.topic: include
55
ms.date: 08/14/2023
66
ms:author: mbender
77
---
8-
> [!Note]
9-
> When the ALB Controller creates the Application Gateway for Containers resources in ARM, it'll use the following naming convention for a frontend resource: fe-\<8 randomly generated characters\>
8+
> [!NOTE]
9+
> When the ALB Controller creates the Application Gateway for Containers resources in Azure Resource Manager, it uses the following naming convention for a frontend resource: `fe-<eight randomly generated characters>`.
1010
>
11-
> If you would like to change the name of the frontend created in Azure, consider following the [bring your own deployment strategy](../articles/application-gateway/for-containers/overview.md#deployment-strategies).
11+
> If you want to change the name of the frontend resource created in Azure, consider following the [bring-your-own deployment strategy](../articles/application-gateway/for-containers/overview.md#deployment-strategies).

0 commit comments

Comments
 (0)