Skip to content

Commit 6794920

Browse files
committed
Merge branch 'main' into release-backup-security
2 parents 1ba19fb + 4bfb69d commit 6794920

44 files changed

Lines changed: 2626 additions & 1684 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.openpublishing.publish.config.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,29 @@
512512
"branch": "docs-snippets",
513513
"branch_mapping": {}
514514
},
515+
{
516+
"path_to_root": "functions-scenarios-custom-mcp-dotnet",
517+
"url": "https://github.com/Azure-Samples/remote-mcp-functions-dotnet",
518+
"branch": "main",
519+
"branch_mapping": {}
520+
},
521+
{
522+
"path_to_root": "functions-scenarios-custom-mcp-python",
523+
"url": "https://github.com/Azure-Samples/remote-mcp-functions-python",
524+
"branch": "main",
525+
"branch_mapping": {}
526+
},
527+
{
528+
"path_to_root": "functions-scenarios-custom-mcp-java",
529+
"url": "https://github.com/Azure-Samples/remote-mcp-functions-java",
530+
"branch": "main",
531+
"branch_mapping": {}
532+
}, {
533+
"path_to_root": "functions-scenarios-custom-mcp-typescript",
534+
"url": "https://github.com/Azure-Samples/remote-mcp-functions-typescript",
535+
"branch": "main",
536+
"branch_mapping": {}
537+
},
515538
{
516539
"path_to_root": "ImmersiveReaderSdk",
517540
"url": "https://github.com/microsoft/immersive-reader-sdk",
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: JSON Web Token (JWT) validation in Azure Application Gateway
3+
titleSuffix: Azure Application Gateway
4+
description: Learn how to configure JSON Web Token (JWT) validation in Azure Application Gateway to enforce authentication and authorization policies.
5+
author: rnautiyal
6+
ms.author: rnautiyal
7+
ms.reviewer: mbender
8+
ms.service: azure-application-gateway
9+
ms.topic: conceptual
10+
ms.date: 11/06/2025
11+
---
12+
13+
# JSON Web Token (JWT) validation in Azure Application Gateway (Preview)
14+
15+
## Overview
16+
17+
[Azure Application Gateway](/azure/application-gateway/) provides built-in JSON Web Token (JWT) validation at the gateway routing layer. This capability verifies the integrity and validity of tokens in incoming requests and makes an allow-or-deny decision before forwarding traffic to backend services. Upon successful validation, the gateway adds the `x-msft-entra-identity` header and passes it to the backend.
18+
19+
By performing token validation at the edge, Application Gateway helps simplify application architecture and enhance overall security. JWT validation in Application Gateway is stateless—each request must include a valid token for access to be granted. The gateway doesn't maintain any session or cookie-based state, ensuring consistent token checks and compliance with [Zero Trust](/security/zero-trust/zero-trust-overview) principles.
20+
21+
With JWT validation, Application Gateway can:
22+
23+
- Verify token integrity by using a trusted issuer and signing keys.
24+
- Validate claims such as audience, issuer, and expiration.
25+
- Block requests with invalid or missing tokens before they reach your backend.
26+
27+
## Why use JWT validation?
28+
29+
- **Zero Trust alignment:** Ensure only authenticated traffic reaches your application.
30+
- **Simplified architecture:** Offload token validation from backend services.
31+
- **Improved security:** Reduce attack surface and prevent unauthorized access.
32+
33+
## Supported scenarios
34+
35+
- Validate JWT tokens in the `Authorization` header.
36+
- Provide an allow-or-deny decision based on token validity.
37+
- Integrate with Web Application Firewall (WAF) policies for layered security.
38+
39+
## Configure JWT validation
40+
41+
This section provides a step-by-step guide to configure JWT validation in Azure Application Gateway.
42+
43+
### Step 1: Register an application in Microsoft Entra ID
44+
45+
To issue JWTs for testing, register an application in [Microsoft Entra](/entra/fundamentals/what-is-entra) ID:
46+
47+
1. Go to [Azure portal → App registrations](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade).
48+
1. Select **New registration**.
49+
1. Enter:
50+
- **Name:** `appgw-jwt-demo`
51+
- **Supported account types:** *Accounts in this organizational directory only*.
52+
1. Select **Register**.
53+
1. Copy:
54+
- **Application (client) ID**`CLIENT_ID`
55+
- **Directory (tenant) ID**`TENANT_ID`.
56+
57+
### Step 2: Configure JWT validation in Application Gateway
58+
59+
Use the Azure portal to create a JWT validation configuration in Application Gateway:
60+
61+
1. Open the preview configuration portal:
62+
[App Gateway JWT Config Portal](https://ms.portal.azure.com/?feature.canmodifystamps=true&Microsoft_Azure_HybridNetworking=flight23&feature.applicationgatewayjwtvalidation=true).
63+
1. Select **JWT validation configuration**.
64+
1. Provide the following details:
65+
66+
| Field | Example | Description |
67+
| ------------------------ | ------------------------------ | ------------------------------------------------------------------------ |
68+
| **Name** | `jwt-validation-demo` | Friendly name for the validation configuration |
69+
| **Unauthorized Request** | Deny | Reject requests with missing or invalid JWTs |
70+
| **Tenant ID** | `<your-tenant-id>` | Must be a valid GUID or one of `common`, `organizations`, or `consumers` |
71+
| **Client ID** | `<your-client-id>` | GUID of the app registered in Microsoft Entra |
72+
| **Audiences** | (Optional) `api://<client-id>` | Expected audience claim matching scope |
73+
74+
1. Associate the configuration with a **Routing rule** (see next section).
75+
76+
### Step 3: Create an HTTPS routing rule
77+
78+
Use the Azure portal to create an HTTPS listener and routing rule that uses the JWT validation configuration:
79+
80+
1. Go to **Application Gateway → Rules → Add Routing rule**.
81+
1. Configure the rule:
82+
- **Listener:** Protocol `HTTPS`, assign certificate, or Key Vault secret.
83+
- **Backend target:** Select or create a backend pool.
84+
- **Backend settings:** Use appropriate HTTP/HTTPS port.
85+
- **Rule name:** For example, `jwt-route-rule`.
86+
1. Link this rule to your JWT validation configuration.
87+
88+
Your JWT validation configuration is now attached to a secure HTTPS listener and routing rule.
89+
90+
### Step 4: Retrieve an access token using Azure CLI
91+
92+
Use the Azure CLI to get a JWT access token for testing:
93+
94+
```bash
95+
az login --tenant "<TENANT_ID>"
96+
97+
CLIENT_ID="<your-client-id>"
98+
TENANT_ID="<your-tenant-id>"
99+
100+
TOKEN=$(az account get-access-token \
101+
--scope "https://management.azure.com/.default" \
102+
--query accessToken -o tsv)
103+
```
104+
105+
### Step 5: Test connectivity
106+
107+
Use `curl` to send a request to the Application Gateway with the retrieved token:
108+
109+
```bash
110+
111+
curl -H "Authorization: Bearer $TOKEN" https://appgwFrontendIpOrDns:configuredPort/pathToListenerWithRoute
112+
113+
```
114+
115+
## Expected behavior
116+
117+
When you test the Application Gateway with JWT validation enabled, expect the following responses:
118+
119+
**401 Unauthorized response** occurs when:
120+
- No token is provided in the request
121+
- The token is invalid or expired
122+
123+
**Successful validation** results in:
124+
- The request forwarded to the backend target
125+
- An additional `x-msft-entra-identity` header included in the forwarded request
126+
127+
### Next steps
128+
129+
- [Learn about JSON Web Tokens (JWT)](/entra/identity-platform/access-token-claims-reference)
130+
- [Discover the fundamentals of identity with Microsoft Entra](/entra/fundamentals/what-is-entra)

0 commit comments

Comments
 (0)