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
Copy file name to clipboardExpand all lines: docs/agent-id/how-to-validate-agent-tokens-downstream-api.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ The following diagram shows how tokens flow from the agent through the sidecar t
57
57
58
58
:::image type="content" source="media/how-to-validate-agent-tokens-downstream-api/agent-token-flow-to-downstream-api.png" alt-text="Diagram showing the agent caller sending a Bearer token to the weather API, which verifies the token and calls Open-Meteo." lightbox="media/how-to-validate-agent-tokens-downstream-api/agent-token-flow-to-downstream-api.png":::
59
59
60
-
TR is the agent identity token issued by Microsoft Entra ID through the sidecar. It contains the claims your API validates, including the `xms_par_app_azp` agent identity marker. For a detailed breakdown of all tokens in the flow, see [Run the sidecar for local development](sidecar-local-development.md#understand-the-token-flow).
60
+
The agent identity token, TR, is issued by Microsoft Entra ID through the sidecar. It contains the claims your API validates, including the `xms_par_app_azp` agent identity marker. For a detailed breakdown of all tokens in the flow, see [Run the sidecar for local development](sidecar-local-development.md#understand-the-token-flow).
61
61
62
62
Token validation libraries differ across ecosystems (Python, Node.js, .NET). This sample uses PyJWT with the `cryptography` backend for RS256 signature verification. When you build your own downstream API, choose the equivalent JWT validation library for your technology stack.
Copy file name to clipboardExpand all lines: docs/agent-id/integrate-aws-bedrock-agent.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,8 @@ Run the following commands once per tenant to create the Blueprint app, Agent ID
126
126
-**`AGENT_CLIENT_ID`:** The Agent ID created from the Blueprint.
127
127
128
128
1. (Optional) Create the SPA app and configure OBO. This step is required only if you want to use the OBO identity flow:
129
+
130
+
Run the following scripts to create the SPA app registration and configure OBO permissions on the Blueprint. The scripts register the SPA redirect URI and grant the required delegated permissions.
129
131
130
132
**Bash:**
131
133
@@ -156,7 +158,7 @@ The sidecar supports multiple credential types through the `AzureAd__ClientCrede
156
158
-**`KeyVault`:** Certificate from Azure Key Vault.
157
159
-**`StoreWithThumbprint`:** Certificate from local machine store.
158
160
159
-
1.Copy the environment template and open it in your editor:
161
+
1. Create a local `.env` configuration file from the included template. This file stores your tenant, app, and AWS credentials:
160
162
161
163
**Bash:**
162
164
@@ -191,13 +193,15 @@ The sidecar supports multiple credential types through the `AzureAd__ClientCrede
191
193
192
194
## Start the stack
193
195
194
-
1. Make sure Docker is running and then start all containers:
196
+
1. Verify that Docker Desktop (or Docker Engine) is running on your machine.
197
+
198
+
1. Build the container images and start all three services (agent, sidecar, and weather API) in detached mode:
195
199
196
200
```bash
197
201
docker compose up --build -d
198
202
```
199
203
200
-
1.Verify the stack is ready:
204
+
1.Check that all containers started successfully by querying the status endpoint. The response reports whether the agent can reach AWS Bedrock:
201
205
202
206
**Bash:**
203
207
@@ -245,28 +249,28 @@ If something isn't working as expected, check the following table for common iss
|`4xx` from sidecar during OBO |`CLIENT_SPA_APP_ID` missing or SPA redirect URI mismatch. | Rerun `setup-obo-client-app`. Ensure `http://localhost:3001` is on the SPA's redirect URIs. |
247
251
248
-
View container logs for debugging:
252
+
If an issue persists even after following the troubleshooting steps, inspect the container logs directly. Each service logs to its own container:
When you finish testing, stop the local containers to free system resources. Choose one of the following cleanup options based on whether you want to keep images for faster restarts.
262
+
263
+
> [!IMPORTANT]
264
+
> `docker compose down` removes only the local Docker containers. Microsoft Entra objects (agent blueprint, Agent ID, SPA app registration) are tenant-side state and persist. Delete them manually in the Microsoft Entra admin center if you no longer need them.
259
265
260
266
```bash
261
-
# Stop containers but keep volumes and images
267
+
# Stop containers but keep volumes and images for faster restarts
262
268
docker compose down
263
269
264
270
# Remove everything including volumes and images
265
271
docker compose down -v --rmi all
266
272
```
267
273
268
-
The Entra objects (agent blueprint, Agent ID, SPA app registration) are tenant-side state, so using `docker compose down` won't remove them. Remove them manually in the Microsoft Entra admin center if no longer needed.
269
-
270
274
## Related content
271
275
272
276
-[Authentication with Microsoft Entra Auth SDK (sidecar)](authentication-with-auth-sdk-sidecar.md)
Copy file name to clipboardExpand all lines: docs/agent-id/interactive-agent-authentication-authorization-flow.md
+29-23Lines changed: 29 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,14 @@ ms.author: dmwendia
7
7
ms.topic: how-to
8
8
ms.date: 03/17/2026
9
9
ms.reviewer: dastrock, jomondi
10
+
ai-usage: ai-assisted
10
11
11
12
#customer-intent: As a developer building interactive agents, I want to authenticate users, configure authorization, and acquire tokens through the On-Behalf-Of flow, so that my agent can securely act on behalf of users to access protected resources.
12
13
---
13
14
14
15
# Authenticate users and acquire tokens for interactive agents
15
16
16
-
Interactive agents take actions on behalf of users. To do so securely, the agent must authenticate the user, obtain consent for the required permissions, and acquire access tokens for downstream APIs. This article walks you through implementing the end-to-end flow for your interactive agent:
17
+
Interactive agents take actions on behalf of users. To act on behalf of users securely, the agent authenticates the user, gets consent for required permissions, and acquires access tokens for downstream APIs. This article walks you through the end-to-end authentication and token acquisition flow for your interactive agent:
17
18
18
19
1. Register a redirect URI for your agent identity blueprint.
19
20
1. Configure user or admin authorization (consent).
@@ -32,6 +33,7 @@ Before you begin, ensure you have:
32
33
- An [agent identity](create-delete-agent-identities.md).
33
34
- A client application registered in Microsoft Entra to handle user authentication.
34
35
- Familiarity with the [OAuth 2.0 authorization code flow](/entra/identity-platform/v2-oauth2-auth-code-flow).
36
+
- The ability to run an ASP.NET Core web API if you plan to use the token validation and OBO samples in this article.
35
37
36
38
For admin authorization, you also need:
37
39
@@ -41,9 +43,9 @@ For admin authorization, you also need:
41
43
42
44
To support delegated permissions, your agent identity blueprint must be configured with a valid redirect URI. This URI is where Microsoft Entra ID sends users after they grant or deny consent to your agent.
### [Use Microsoft Graph API](#tab/microsoft-graph-api)
45
47
46
-
To send this request, you first need to obtain an access token with the delegated permission `AgentIdentityBlueprint.ReadWrite.All`.
48
+
To update the redirect URI on the agent identity blueprint, you first need to obtain an access token with the delegated permission `AgentIdentityBlueprint.ReadWrite.All`. Then send a PATCH request to the application object for the agent identity blueprint:
Before the agent can act on behalf of a user, the user must consent to the required permissions. This consent step doesn't return a token. Instead, it records that the user has granted the agent permission to act on their behalf. Token acquisition happens in a [later step](#authenticate-the-user-and-request-a-token).
90
-
91
-
To prompt a user for consent, construct an authorization URL and redirect the user to it. The agent can present this URL in different ways, for example, as a link in a chat message.
93
+
Before the agent can act on behalf of a user, the user must consent to the required permissions. The user consent request doesn't return a token. Instead, it records that the user granted the agent permission to act on their behalf. Token acquisition happens in [Authenticate the user and request a token](#authenticate-the-user-and-request-a-token).
92
94
93
95
> [!IMPORTANT]
94
96
> Use the **agent identity** client ID in the `client_id` parameter, not the agent identity blueprint ID.
95
97
96
-
```http
98
+
To prompt a user for consent, construct an authorization URL and redirect the user to it. The agent can present this URL in different ways, for example, as a link in a chat message.
When the user opens this URL, Microsoft Entra ID prompts them to sign in and grant consent to the permissions specified in the `scope` parameter. After consent is granted, the user is redirected to the specified redirect URI.
110
+
When the user opens this URL, Microsoft Entra ID prompts them to sign in and grant consent. After consent, the user is sent back to the redirect URI.
107
111
108
-
The key parameters in the consent URL are:
112
+
The key parameters in the user consent authorization URL are:
109
113
110
114
-`client_id`: The agent identity client ID (not the agent identity blueprint client ID).
111
-
-`response_type`: Set to `none` because this request records consent only. Token acquisition uses `response_type=code` in a [separate request](#authenticate-the-user-and-request-a-token).
112
-
-`redirect_uri`: Must match exactly what you configured in the previous step.
115
+
-`response_type`: Set to `none` because this request records consent only. Token acquisition uses `response_type=code` in [Authenticate the user and request a token](#authenticate-the-user-and-request-a-token).
116
+
-`redirect_uri`: Must match exactly the redirect URI configured on the agent identity blueprint.
113
117
-`scope`: Specify the delegated permissions you need (for example, `User.Read`).
114
118
-`state`: Optional parameter for maintaining state between the request and callback.
115
119
116
120
For more information on OAuth authorization concepts, see [Permissions and consent in the Microsoft identity platform](/entra/identity-platform/permissions-consent-overview).
117
121
118
122
## Configure admin authorization
119
123
120
-
Agents can also request authorization from a Microsoft Entra ID administrator, who can grant authorization to the agent for all users in their tenant. Application permissions require admin authorization because individual users can't consent to them.
124
+
An administrator in Microsoft Entra ID can grant consent to the agent for all users in the tenant. Use admin consent when you need application permissions, because individual users can't consent to them.
121
125
122
-
To grant admin consent, construct the authorization URL that prompts the administrator. Use the agent identity ID in the following request.
126
+
To grant tenant-wide admin consent, direct an administrator to the following URL. Use the agent identity ID in the `client_id` parameter.
After the administrator grants consent, the permissions are applied tenant-wide and users in that tenantdon't need to individually consent to those permissions.
136
+
After the administrator grants consent, the permissions apply to the whole tenant. Users don't need to consent again.
133
137
134
138
## Authenticate the user and request a token
135
139
136
-
After authorization is configured, the client app (such as a frontend or mobile app) initiates an OAuth 2.0 authorization code request to obtain a token where the audience is the agent identity blueprint. In this step, `client_id` refers to the client app's own registered application ID, not the agent identity or agent identity blueprint ID.
140
+
After authorization is configured, the client app (such as a frontend or mobile app) starts an OAuth 2.0 authorization code request. The token audience is the agent identity blueprint. In the authorization code request, `client_id` refers to the client app's own registered application ID, not the agent identity or agent identity blueprint ID.
137
141
138
142
1. Redirect the user to the Microsoft Entra ID authorization endpoint with the following parameters:
139
143
@@ -146,7 +150,7 @@ After authorization is configured, the client app (such as a frontend or mobile
146
150
&state=abc123
147
151
```
148
152
149
-
1. After the user signs in, your app receives an authorization code at the redirect URI. Exchange it for an access token:
153
+
1. After the user signs in, your app receives an authorization code at the redirect URI. Exchange the authorization code for an access token:
150
154
151
155
```http
152
156
POST https://login.microsoftonline.com/<my-test-tenant>/oauth2/v2.0/token
@@ -166,7 +170,7 @@ After authorization is configured, the client app (such as a frontend or mobile
166
170
167
171
## Validate the access token
168
172
169
-
The agent, typically exposed via a web API, must validate the access token. Always use an approved library to perform token validation. Never implement your own token validation code.
173
+
The web API must validate the incoming access token before the agent can act. Always use an approved library to validate tokens. Don't write your own token validation code.
170
174
171
175
1. Install the `Microsoft.Identity.Web` NuGet package:
172
176
@@ -214,7 +218,7 @@ For more information about Microsoft.Identity.Web, see [Microsoft.Identity.Web d
214
218
215
219
## Validate user claims
216
220
217
-
After you validate the access token, the agent can identify the user and perform authorization checks. This example API route extracts user claims from the access token and returns them in the API response:
221
+
After access token validation, the agent can identify the user and perform authorization checks. The following example API route extracts user claims from the access token and returns them in the API response:
### [Use Microsoft Identity Web](#tab/identity-web-tokens)
242
246
243
247
The `Microsoft.Identity.Web` library simplifies the OBO implementation by handling token exchange automatically, so you don't have to manually implement the flow by following the protocol.
244
248
@@ -274,7 +278,7 @@ The `Microsoft.Identity.Web` library simplifies the OBO implementation by handli
274
278
app.Run();
275
279
```
276
280
277
-
1. In the agent API, exchange the incoming access token for a new access token for the agent identity. `Microsoft.Identity.Web` validates the incoming access token and handles the on-behalf-of token exchange:
281
+
1. In the agent API, exchange the incoming user access token for a new access token for the agent identity. `Microsoft.Identity.Web` validates the incoming access token and handles the on-behalf-of token exchange:
Copy file name to clipboardExpand all lines: docs/id-governance/entitlement-management-access-package-assignments.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ In some cases, you might want to directly assign specific identities to an acces
113
113
> [!NOTE]
114
114
> Access package assignment managers will no longer be able to bypass approval settings if the policy requires approval. This means identities can't be directly assigned to the package without necessary approval(s) from the designated approver(s). In the case that you need to bypass approval, we recommend creating a second policy on the access package that does not require approval and is scoped only to identities who need access.
115
115
116
-
## Directly assign any identity (Preview)
116
+
## Directly assign any identity
117
117
118
118
Entitlement management also allows you to directly assign external identities to an access package to make collaborating with partners easier. To do this, the access package must have a policy that allows identities not yet in your directory to request access.
119
119
@@ -130,7 +130,7 @@ Entitlement management also allows you to directly assign external identities to
130
130
131
131
1. In the **Select policy** list, select a policy that allows that is set to **For users not in your directory**
132
132
133
-
1. Select **External user (Preview)**. You're able to specify which users you want to assign to this access package.
133
+
1. Select **External user**. You're able to specify which users you want to assign to this access package.
134
134

135
135
136
136
1. Enter the identity **Name** (optional) and the identity **Email address** (required).
0 commit comments