Skip to content

Commit f1c326f

Browse files
committed
edit pass: web-application-firewall-on-application-gateway-for-containers
1 parent 10fd2e4 commit f1c326f

File tree

3 files changed

+105
-101
lines changed

3 files changed

+105
-101
lines changed

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

Lines changed: 74 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,45 @@ 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). - Provisioned the Application Gateway for Containers resources via the [ApplicationLoadBalancer custom resource](quickstart-create-application-gateway-for-containers-managed-by-alb-controller.md).
33+
34+
- Apply the following `deployment.yaml` file on your cluster to create a sample web application that demonstrates the header rewrite:
35+
36+
```bash
37+
kubectl apply -f https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/refs/heads/main/articles/application-gateway/for-containers/examples/traffic-split-scenario/deployment.yaml
38+
```
3639

37-
This command creates the following on your cluster:
40+
This command creates the following items on your cluster:
3841

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
42+
- A namespace called `test-infra`
43+
- Two services called `backend-v1` and `backend-v2` in the `test-infra` namespace
44+
- Two deployments called `backend-v1` and `backend-v2` in the `test-infra` namespace
4245

4346
## Deploy the required Gateway API resources
4447

4548
# [ALB managed deployment](#tab/alb-managed)
4649

47-
Create a gateway:
50+
Create a `Gateway` resource:
4851

4952
```bash
5053
kubectl apply -f - <<EOF
@@ -70,53 +73,53 @@ EOF
7073

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

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

75-
1. Set the following environment variables
78+
1. Set the following environment variables:
7679

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-
```
80+
```bash
81+
RESOURCE_GROUP='<resource group name of the Application Gateway For Containers resource>'
82+
RESOURCE_NAME='alb-test'
83+
84+
RESOURCE_ID=$(az network alb show --resource-group $RESOURCE_GROUP --name $RESOURCE_NAME --query id -o tsv)
85+
FRONTEND_NAME='frontend'
86+
```
8487

85-
2. Create a Gateway
88+
2. Create a `Gateway` resource:
8689

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-
```
90+
```bash
91+
kubectl apply -f - <<EOF
92+
apiVersion: gateway.networking.k8s.io/v1
93+
kind: Gateway
94+
metadata:
95+
name: gateway-01
96+
namespace: test-infra
97+
annotations:
98+
alb.networking.azure.io/alb-id: $RESOURCE_ID
99+
spec:
100+
gatewayClassName: azure-alb-external
101+
listeners:
102+
- name: http-listener
103+
port: 80
104+
protocol: HTTP
105+
allowedRoutes:
106+
namespaces:
107+
from: Same
108+
addresses:
109+
- type: alb.networking.azure.io/alb-frontend
110+
value: $FRONTEND_NAME
111+
EOF
112+
```
110113
111114
---
112115
113-
Once the gateway resource is created, ensure the status is valid, the listener is _Programmed_, and an address is assigned to the gateway.
116+
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:
114117
115118
```bash
116119
kubectl get gateway gateway-01 -n test-infra -o yaml
117120
```
118121
119-
Example output of successful gateway creation.
122+
Here's example output of successful creation of a `Gateway` resource:
120123
121124
```yaml
122125
status:
@@ -163,7 +166,7 @@ status:
163166
kind: HTTPRoute
164167
```
165168
166-
Once the gateway is created, create an HTTPRoute that listens for hostname contoso.com.
169+
Create an `HTTPRoute` resource that listens for the host name `contoso.com`:
167170
168171
```bash
169172
kubectl apply -f - <<EOF
@@ -185,13 +188,13 @@ spec:
185188
EOF
186189
```
187190
188-
Once the HTTPRoute resource is created, ensure the route is _Accepted_ and the Application Gateway for Containers resource is _Programmed_.
191+
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`:
189192
190193
```bash
191194
kubectl get httproute header-rewrite-route -n test-infra -o yaml
192195
```
193196
194-
Verify the status of the Application Gateway for Containers resource has been successfully updated.
197+
Verify that the status of the Application Gateway for Containers resource was successfully updated:
195198
196199
```yaml
197200
status:
@@ -225,7 +228,7 @@ status:
225228
226229
### Configure WebApplicationFirewallPolicy
227230
228-
Application Gateway for Containers uses a custom resource called `WebApplicationFirewallPolicy` to define WAF protection. In this example, WAF will protect a specific HTTPRoute.
231+
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:
229232
230233
```bash
231234
kubectl apply -f - <<EOF
@@ -240,12 +243,13 @@ spec:
240243
kind: HTTPRoute
241244
name: contoso-waf-route
242245
namespace: test-infra
243-
#sectionNames: ["listenerA"] # defined if targeting a specific listener on a gateway resource or path
246+
#sectionNames: ["listenerA"] # defined if you're targeting a specific listener on a gateway resource or path
244247
webApplicationFirewall:
245248
id: /subscriptions/.../Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/waf-policy-0
246249
EOF
247250
```
248251
252+
```bash
249253
kubectl apply -f - <<EOF
250254
apiVersion: alb.networking.azure.io/v1
251255
kind: WebApplicationFirewallPolicy
@@ -258,27 +262,28 @@ spec:
258262
kind: HTTPRoute
259263
name: contoso-waf-route
260264
namespace: test-infra
261-
#sectionNames: ["listenerA"] # defined if targeting a specific listener on a gateway resource or path
265+
#sectionNames: ["listenerA"] # defined if you're targeting a specific listener on a gateway resource or path
262266
webApplicationFirewall:
263267
id: /subscriptions/711d99a7-fd79-4ce7-9831-ea1afa18442e/resourceGroups/AGC-RG/providers/Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/agc-waf
264268
EOF
269+
```
265270
266271
## Test access to the application
267272
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:
273+
Now you're ready to send some traffic to the sample application, via the fully qualified domain name (FQDN) assigned to the front end. Use the following command to get the FQDN:
269274
270275
```bash
271276
fqdn=$(kubectl get gateway gateway-01 -n test-infra -o jsonpath='{.status.addresses[0].value}')
272277
```
273278
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.
279+
If you specify the server name indicator by using the `curl` command, with `contoso.com` for the front-end FQDN, the output should return a response from the `backend-v1` service:
275280
276281
```bash
277282
fqdnIp=$(dig +short $fqdn)
278283
curl -k --resolve contoso.com:80:$fqdnIp http://contoso.com
279284
```
280285
281-
Via the response we should see:
286+
Via the response, you should see:
282287
283288
```json
284289
{
@@ -310,18 +315,18 @@ Via the response we should see:
310315
}
311316
```
312317
313-
Now, send a request with a malicious query string to trigger a `403 forbidden` response from your Application Gateway for Containers.
318+
Now, send a request with a malicious query string to trigger a `403 forbidden` response from Application Gateway for Containers.
314319
315-
**Example 1:**
320+
Here's one example request:
316321
317322
```bash
318323
curl -k --resolve contoso.com:80:$fqdnIp http://contoso.com/?text=/etc/passwd
319324
```
320325
321-
**Example 2:**
326+
Here's another example request:
322327
323328
```bash
324329
curl -k --resolve contoso.com:80:$fqdnIp http://contoso.com/?1=1=1
325330
```
326331
327-
Congratulations, you have installed ALB Controller, deployed a backend application and used Web Application Firewall functionality to block a malicious request.
332+
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: 28 additions & 29 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 is what 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,24 +56,23 @@ 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-
* WAF Security Copilot – Embedded
63-
* JavaScript (JS) Challenge Actions
64-
* CRS 3.2 and lower ruleset
61+
* Azure Web Application Firewall integration in Microsoft Security Copilot
62+
* Azure Web Application Firewall integration in Microsoft Security Copilot (embedded)
63+
* JavaScript challenge actions
64+
* Core Rule Set (CRS) 3.2 and earlier rulesets
6565
6666
## Pricing
6767
68-
WAF is incrementally billed in addition to Application Gateway for Containers. Two meters track WAF consumption:
68+
Azure Web Application Firewall is incrementally billed in addition to Application Gateway for Containers. Two metrics track Azure Web Application Firewall consumption:
6969
70-
* AGC WAF Hour
71-
* AGC 1M WAF Requests
70+
* `AGC WAF Hour`
71+
* `AGC 1M WAF Requests`
7272

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

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

7777
> [!NOTE]
78-
> Application Gateway for Containers + WAF is in PREVIEW.
79-
> 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.
78+
> The integration 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 front-end 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 front end 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)