You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: JSON Web Token (JWT) validation in Azure Application Gateway (Preview)
2
+
title: JSON Web Token (JWT) Validation in Azure Application Gateway (Preview)
3
3
titleSuffix: Azure Application Gateway
4
4
description: Learn how to configure JSON Web Token (JWT) validation in Azure Application Gateway to enforce authentication and authorization policies.
5
5
author: rnautiyal
@@ -9,158 +9,153 @@ ms.topic: article
9
9
ms.date: 11/18/2025
10
10
---
11
11
12
-
# JSON Web Token (JWT) validation in Azure Application Gateway (Preview)
12
+
# JSON Web Token (JWT) validation in Azure Application Gateway (preview)
13
13
14
-
The Microsoft Entra JSON Web Tokens (JWTs) feature enables [Azure Application Gateway](/azure/application-gateway/)to validate JSON Web Tokens (JWTs) issued by [Microsoft Entra ID](https://docs.azure.cn/en-us/entra/fundamentals/what-is-entra) (formerly Azure Active Directory) in incoming HTTPS requests. This provides first-hop authentication enforcement for Web APIs or any protected resource without requiring custom code in your backend applications. This capability verifies the integrity and authenticity of tokens in incoming requests and determines whether to allow or deny access before forwarding traffic to backend services. Upon successful validation, the gateway injects the ``x-msft-entra-identity`` header into the request and forwards it to the backend, enabling downstream applications to securely consume verified identity information
14
+
[Azure Application Gateway](/azure/application-gateway/)validates JSON Web Tokens (JWTs) issued by [Microsoft Entra ID](https://docs.azure.cn/en-us/entra/fundamentals/what-is-entra) (formerly Azure Active Directory) in incoming HTTPS requests. This capability provides first-hop authentication enforcement for web APIs or any protected resource without requiring custom code in your backend applications.
15
15
16
-
By performing token validation at the edge, Application Gateway simplifies application architecture and strengthens overall security posture. JWT validation is stateless, meaning each request must present a valid token for access to be granted. No session or cookie-based state is maintained, ensuring consistent validation across requests and alignment with [Zero Trust](/security/zero-trust/zero-trust-overview) principles.
16
+
This capability verifies the integrity and authenticity of tokens in incoming requests. It then determines whether to allow or deny access before forwarding traffic to backend services. Upon successful validation, the gateway injects the `x-msft-entra-identity` header into the request and forwards it to the backend. Downstream applications can then securely consume verified identity information.
17
+
18
+
By performing token validation at the edge, Application Gateway simplifies application architecture and strengthens overall security posture. JWT validation is stateless. That is, each request must present a valid token for access to be granted.
19
+
20
+
Application Gateway doesn't maintain any session or cookie-based state. This approach helps ensure consistent validation across requests and alignment with [Zero Trust](/security/zero-trust/zero-trust-overview) principles.
17
21
18
22
> [!IMPORTANT]
19
-
> JWT validation in Azure Application Gateway is currently in **Public Preview**. This preview version is provided without a servicelevel agreement, and isn't recommended for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
23
+
> JWT validation in Azure Application Gateway is currently in preview. This preview version is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
1. Note down the values for **Application (client) ID** and **Directory (tenant) ID**.
88
71
89
-
1.Open your Application Gateway, navigate to Settings in the left menu, and select the **JWT validation configuration** window.
72
+
1.(Optional) Configure an application ID URI:
90
73
91
-
:::image type="content" source="media/json-web-token-overview/json-web-token-configuration.png" alt-text="Screenshot of JSON Web Token configuration window for Application Gateway.":::
74
+
1. Go to **Expose an API** > **Set Application ID URI**.
75
+
1. Use the default `api://<ClientID>` or a custom URI (for example, `https://api.contoso.com`).
This capability is for future authorization features. It's not required for the preview.
103
82
104
-
1. Associate the configuration with a **Routing rule** (see next section if new routing rule is needed).
83
+
## Configure JWT validation in Application Gateway
84
+
85
+
1. Open the [preview configuration portal](https://ms.portal.azure.com/?feature.applicationgatewayjwtvalidation=true#home).
86
+
87
+
1. Open your Application Gateway instance, go to **Settings** on the left menu, and then select **JWT validation configurations** > **Add JWT validation configuration**.
88
+
89
+
:::image type="content" source="media/json-web-token-overview/json-web-token-configuration.png" alt-text="Screenshot of the pane for updating JSON Web Token configuration for Application Gateway.":::
105
90
91
+
1. Provide the following details:
106
92
107
-
## Create a routing rule (if needed)
93
+
| Setting | Example | Description |
94
+
| ------- | ------- | ----------- |
95
+
|**Name**|`jwt-policy-1`| Friendly name for the validation configuration |
96
+
|**Unauthorized Request**|`Deny`| Option to reject requests with missing or invalid JWTs |
97
+
|**Tenant ID**|`<your-tenant-id>`| Valid GUID or one of `common`, `organizations`, or `consumers`|
98
+
|**Client ID**|`<your-client-id>`| GUID of the app registered in Microsoft Entra |
1.Go to **Application Gateway -> Rules -> Add Routing rule**
101
+
1.Associate the configuration with a routing rule as described in the following section, if you need a new routing rule.
110
102
111
-
1. Enter or select the following:
112
-
-**Listener:** Protocol `HTTPS`, assign certificate, or Key Vault secret.
113
-
-**Backend target:** Select or create a backend pool.
114
-
-**Backend settings:** Use appropriate HTTP/HTTPS port.
115
-
-**Rule name:** For example, `jwt-route-rule`.
103
+
## Create a routing rule (if necessary)
116
104
117
-
1.Link this rule to your JWT validation configuration. Your JWT validation configuration is now attached to a secure HTTPS listener and routing rule.
105
+
1.Go to **Application Gateway** > **Rules** > **Add Routing rule**.
118
106
107
+
1. Enter or select the following items:
108
+
-**Listener**: Use the protocol `HTTPS`, an assigned certificate, or an Azure Key Vault secret.
109
+
-**Backend target**: Select or create a backend pool.
110
+
-**Backend settings**: Use an appropriate HTTP/HTTPS port.
111
+
-**Rule name**: Enter a name such as `jwt-route-rule`.
119
112
120
-
## Send a JWT Access Token with Every Request to the Secure Application
113
+
1. Link this rule to your JWT validation configuration.
121
114
122
-
To securely access an application protected by Application Gateway, the client must first obtain a JWT access token from the Microsoft Entra ID token endpoint. The client then includes this token in the Authorization header (for example, Authorization: Bearer TOKEN) on every request it sends to the Application Gateway. Application Gateway validates the token before forwarding the request to the backend application, ensuring that only authenticated and authorized traffic reaches the secure application.
115
+
Your JWT validation configuration is now attached to a secure HTTPS listener and routing rule.
123
116
124
-
- Learn more about [Access tokens in the Microsoft identity platform](/entra/identity-platform/access-tokens)
117
+
## Send a JWT access token with every request to the secure application
125
118
119
+
To securely access an application that Application Gateway helps protect, the client must first obtain a JWT access token from the Microsoft Entra ID token endpoint. The client then includes this token in the authorization header (for example, `Authorization: Bearer TOKEN`) on every request that it sends to Application Gateway.
126
120
121
+
Application Gateway validates the token before forwarding the request to the backend application. This validation ensures that only authenticated and authorized traffic reaches the secure application.
127
122
128
-
## Expected Outcomes of requests
123
+
For more information, see [Access tokens in the Microsoft identity platform](/entra/identity-platform/access-tokens).
0 commit comments