Skip to content

Commit abfb900

Browse files
committed
docs(providers): add microsoft agent s2s guidance
1 parent 6111e43 commit abfb900

4 files changed

Lines changed: 202 additions & 0 deletions

File tree

docs/get-started/tutorials/index.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ Launch Claude Code in a sandbox, diagnose a policy denial, and iterate on a cust
2727
Configure a Providers v2 Microsoft Graph provider with gateway-managed OAuth2 refresh-token rotation.
2828
</Card>
2929

30+
<Card title="Microsoft Agent S2S Provider" href="/get-started/tutorials/microsoft-agent-s2s">
31+
32+
Create a `microsoft-agent-s2s` provider and verify that a sandboxed workload receives a brokered runtime token URL instead of the Microsoft secret.
33+
</Card>
34+
3035
<Card title="Inference with Ollama" href="/get-started/tutorials/inference-ollama">
3136

3237
Route inference through Ollama using cloud-hosted or local models, and verify it from a sandbox.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
title: "Broker Microsoft Agent S2S Tokens with Providers v2"
5+
sidebar-title: "Microsoft Agent S2S Provider"
6+
slug: "get-started/tutorials/microsoft-agent-s2s"
7+
description: "Create a microsoft-agent-s2s provider, attach it to a sandbox, and verify that the workload receives a brokered runtime token URL instead of the Microsoft secret."
8+
keywords: "Generative AI, Cybersecurity, Tutorial, Providers, Microsoft, A365, Agent 365, S2S, Token Broker"
9+
---
10+
11+
Use Providers v2 to keep Microsoft Agent service-to-service identity material at the gateway while sandboxed workloads request short-lived tokens on demand. Instead of injecting a static bearer token or the blueprint client secret into the sandbox, OpenShell injects a sandbox-local token provider URL and brokers Microsoft tokens for approved audiences at runtime.
12+
13+
After completing this tutorial, you have:
14+
15+
- A `microsoft-agent-s2s` provider instance on your gateway.
16+
- A sandbox with the provider attached.
17+
- A concrete example of the runtime contract the workload receives: `A365_TOKEN_PROVIDER_URL`.
18+
19+
<Warning>
20+
Do not commit Microsoft client secrets, local `.env` files, or emitted bearer tokens. The commands below pass secret material to the gateway; they are not examples of values to store in source control.
21+
</Warning>
22+
23+
<Steps toc={true}>
24+
25+
## Prerequisites
26+
27+
- A working OpenShell installation with an active gateway. Complete the [Quickstart](/get-started/quickstart) before proceeding.
28+
- Providers v2 enabled on the active gateway.
29+
- A Microsoft setup that already provides:
30+
- `AZURE_TENANT_ID`
31+
- `A365_BLUEPRINT_CLIENT_ID`
32+
- `A365_BLUEPRINT_CLIENT_SECRET`
33+
- `A365_RUNTIME_AGENT_ID`
34+
- `A365_ALLOWED_AUDIENCES`
35+
36+
`A365_ALLOWED_AUDIENCES` is a comma-separated list of downstream audiences that the sandboxed workload may request tokens for.
37+
38+
## Enable Providers v2
39+
40+
Enable provider profile policy composition on the active gateway:
41+
42+
```shell
43+
openshell settings set --global --key providers_v2_enabled --value true --yes
44+
```
45+
46+
## Inspect the Built-in Profile
47+
48+
Export the built-in `microsoft-agent-s2s` profile:
49+
50+
```shell
51+
openshell provider profile export microsoft-agent-s2s -o yaml
52+
```
53+
54+
The built-in profile intentionally does not include default network policy. It defines the provider type and discovery shape only.
55+
56+
## Create the Provider
57+
58+
Create a provider instance from the Microsoft S2S inputs:
59+
60+
```shell
61+
openshell provider create \
62+
--name microsoft-a365 \
63+
--type microsoft-agent-s2s \
64+
--credential A365_BLUEPRINT_CLIENT_SECRET="$A365_BLUEPRINT_CLIENT_SECRET" \
65+
--config AZURE_TENANT_ID="$AZURE_TENANT_ID" \
66+
--config A365_BLUEPRINT_CLIENT_ID="$A365_BLUEPRINT_CLIENT_ID" \
67+
--config A365_RUNTIME_AGENT_ID="$A365_RUNTIME_AGENT_ID" \
68+
--config A365_ALLOWED_AUDIENCES="$A365_ALLOWED_AUDIENCES"
69+
```
70+
71+
The provider stores:
72+
73+
- `A365_BLUEPRINT_CLIENT_SECRET` as the secret credential
74+
- `AZURE_TENANT_ID`, `A365_BLUEPRINT_CLIENT_ID`, `A365_RUNTIME_AGENT_ID`, and `A365_ALLOWED_AUDIENCES` as provider config
75+
76+
Unlike a normal placeholder provider, the sandbox does not receive `A365_BLUEPRINT_CLIENT_SECRET` directly.
77+
78+
## Launch a Sandbox
79+
80+
Launch a simple sandbox with the provider attached:
81+
82+
```shell
83+
openshell sandbox create \
84+
--name microsoft-a365-demo \
85+
--keep \
86+
--provider microsoft-a365 \
87+
--no-auto-providers \
88+
-- /bin/sh
89+
```
90+
91+
This tutorial uses `/bin/sh` so you can inspect the runtime contract directly. Substitute your own A365 workload image or startup command later.
92+
93+
## Verify the Runtime Contract
94+
95+
Inside the sandbox, inspect the injected token broker metadata:
96+
97+
```shell
98+
env | grep '^A365_TOKEN_PROVIDER_URL\|^OPENSHELL_MICROSOFT_AGENT_S2S'
99+
```
100+
101+
You should see a local token provider URL and related metadata, for example:
102+
103+
```text
104+
A365_TOKEN_PROVIDER_URL=http://<sandbox-local-resolver>/v1/microsoft-agent-s2s/token/<provider-id>
105+
OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_PROVIDER_URL=http://<sandbox-local-resolver>/v1/microsoft-agent-s2s/token/<provider-id>
106+
OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_URL=http://<sandbox-local-resolver>/v1/microsoft-agent-s2s/token/<provider-id>
107+
OPENSHELL_MICROSOFT_AGENT_S2S_DEFAULT_AUDIENCE=<audience>
108+
```
109+
110+
The important difference from placeholder providers is that the sandbox receives a token URL rather than the blueprint client secret.
111+
112+
## Request a Token from the Local Broker
113+
114+
If your workload knows the audience it wants, it can call the broker URL directly. For example, from inside the sandbox:
115+
116+
```shell
117+
curl -sS "${A365_TOKEN_PROVIDER_URL}?audience=${OPENSHELL_MICROSOFT_AGENT_S2S_DEFAULT_AUDIENCE}"
118+
```
119+
120+
The exact response shape depends on the workload-side adapter, but the flow is always the same:
121+
122+
1. the workload calls the sandbox-local token URL
123+
2. the gateway checks that the sandbox has the provider attached
124+
3. the gateway verifies that the requested audience is allowed
125+
4. the gateway returns a short-lived Microsoft bearer token
126+
127+
OpenShell keeps the blueprint secret and the Microsoft token exchange at the gateway boundary.
128+
129+
## Use the Contract from a Workload
130+
131+
Workloads that already support a token callback can consume the broker directly. For example, the NAT/A365 integration we validated uses this shape:
132+
133+
```yaml
134+
authentication:
135+
a365_auth:
136+
_type: openshell_bearer_token
137+
token_url: ${A365_TOKEN_PROVIDER_URL}
138+
audience: "<audience>"
139+
```
140+
141+
A non-NAT Microsoft agent can use the same OpenShell provider as long as it can request tokens from a callback or token-provider URL instead of requiring a static bearer token or direct access to the Microsoft secret material.
142+
143+
</Steps>

docs/sandboxes/manage-providers.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Create and manage providers that supply credentials to sandboxes.
1616
Providers v2 is available for profile-backed provider policy, provider-owned network rules, and gateway-managed credential refresh. This page remains the credential-focused provider command reference. For the new workflow, see [Providers v2](/sandboxes/providers-v2).
1717
</Info>
1818

19+
<Note>
20+
Most providers inject placeholder environment variables such as `GITHUB_TOKEN` or `OPENAI_API_KEY`. Brokered runtime providers such as `microsoft-agent-s2s` are different: the sandbox receives a local token-provider URL, and the gateway mints short-lived tokens at runtime instead of projecting the long-lived provider secret into the workload.
21+
</Note>
22+
1923
Provider profiles include metadata for known endpoints and binaries. View
2024
the available profiles before creating a provider:
2125

@@ -47,6 +51,19 @@ Supply a credential value directly:
4751
openshell provider create --name my-api --type generic --credential API_KEY=sk-abc123
4852
```
4953

54+
Brokered providers can combine one secret credential with non-secret config. For example, create a Microsoft Agent S2S provider by storing the blueprint client secret as the credential and the Microsoft identity metadata as provider config:
55+
56+
```shell
57+
openshell provider create \
58+
--name microsoft-a365 \
59+
--type microsoft-agent-s2s \
60+
--credential A365_BLUEPRINT_CLIENT_SECRET="$A365_BLUEPRINT_CLIENT_SECRET" \
61+
--config AZURE_TENANT_ID="$AZURE_TENANT_ID" \
62+
--config A365_BLUEPRINT_CLIENT_ID="$A365_BLUEPRINT_CLIENT_ID" \
63+
--config A365_RUNTIME_AGENT_ID="$A365_RUNTIME_AGENT_ID" \
64+
--config A365_ALLOWED_AUDIENCES="$A365_ALLOWED_AUDIENCES"
65+
```
66+
5067
### Bare Key Form
5168

5269
Pass a key name without a value to read the value from the environment variable
@@ -203,6 +220,19 @@ The agent process inside the sandbox never sees real credential values. At start
203220

204221
This resolution requires the proxy to see plaintext HTTP. Endpoints must use `protocol: rest` in the policy (which auto-terminates TLS) or explicit `tls: terminate`. Endpoints without TLS termination pass traffic through as an opaque stream, and credential placeholders are forwarded unresolved.
205222

223+
### Brokered Runtime Providers
224+
225+
Some providers do not inject the primary credential into the workload at all. `microsoft-agent-s2s` is the first built-in example.
226+
227+
Instead of projecting `A365_BLUEPRINT_CLIENT_SECRET` into the sandbox, OpenShell injects sandbox-local token broker metadata:
228+
229+
- `A365_TOKEN_PROVIDER_URL`
230+
- `OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_PROVIDER_URL`
231+
- `OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_URL`
232+
- `OPENSHELL_MICROSOFT_AGENT_S2S_DEFAULT_AUDIENCE`, when the provider config resolves one automatically
233+
234+
The workload calls the local token URL when it needs a bearer token. The gateway validates that the sandbox has the provider attached, checks that the requested audience is allowed by the provider config, and returns a short-lived Microsoft token. This keeps blueprint client secrets and Microsoft token exchange logic out of the sandboxed application process.
235+
206236
### Supported injection locations
207237

208238
The proxy resolves credential placeholders in the following parts of an HTTP request:
@@ -251,6 +281,7 @@ The following provider types are supported.
251281
| `generic` | User-defined | Any service with custom credentials |
252282
| `github` | `GITHUB_TOKEN`, `GH_TOKEN` | GitHub API and `gh` CLI. Refer to [GitHub Sandbox](/get-started/tutorials/github-sandbox). |
253283
| `gitlab` | `GITLAB_TOKEN`, `GLAB_TOKEN`, `CI_JOB_TOKEN` | GitLab API, `glab` CLI |
284+
| `microsoft-agent-s2s` | `A365_TOKEN_PROVIDER_URL`, `OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_PROVIDER_URL`, `OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_URL`, optional `OPENSHELL_MICROSOFT_AGENT_S2S_DEFAULT_AUDIENCE` | Brokered Microsoft Agent 365 service-to-service access. The sandbox receives a local token broker URL rather than the blueprint client secret. Refer to [Microsoft Agent S2S Provider](/get-started/tutorials/microsoft-agent-s2s). |
254285
| `nvidia` | `NVIDIA_API_KEY` | NVIDIA API Catalog |
255286
| `openai` | `OPENAI_API_KEY` | Any OpenAI-compatible endpoint. Set `--config OPENAI_BASE_URL` to point to the provider. Refer to [Inference Routing](/sandboxes/inference-routing). |
256287
| `opencode` | `OPENCODE_API_KEY`, `OPENROUTER_API_KEY`, `OPENAI_API_KEY` | OpenCode |

docs/sandboxes/providers-v2.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Providers v2 keeps those pieces together:
2525
| Custom provider definitions | You can export, edit, lint, import, list, and delete custom profiles. |
2626
| Runtime provider lifecycle | You can list, attach, and detach providers on existing sandboxes. |
2727
| Credential rotation | Provider refresh metadata lets the gateway refresh short-lived access tokens and update provider records. |
28+
| Brokered runtime tokens | Selected providers can keep long-lived identity material at the gateway and inject a sandbox-local token URL instead. |
2829
| Backward compatibility | Credential delivery still uses environment placeholders and proxy rewrite. |
2930

3031
## Enable Providers v2
@@ -60,6 +61,7 @@ Providers v2 currently includes these user-facing features:
6061
- Runtime sandbox provider lifecycle commands under `openshell sandbox provider list|attach|detach`.
6162
- Credential refresh configuration with `openshell provider refresh status|configure|rotate|delete`.
6263
- Credential expiry metadata with `openshell provider update --credential-expires-at`; values accept Unix epoch milliseconds or ISO/RFC3339 timestamps.
64+
- Brokered runtime provider contracts for workloads that need the gateway to mint tokens on demand instead of injecting the underlying secret.
6365

6466
## Roadmap
6567

@@ -94,6 +96,7 @@ Built-in Providers v2 profiles currently include:
9496
|---|---|---|
9597
| `claude-code` | `agent` | `ANTHROPIC_API_KEY`, `CLAUDE_API_KEY` |
9698
| `github` | `source_control` | `GITHUB_TOKEN`, `GH_TOKEN` |
99+
| `microsoft-agent-s2s` | `agent` | `A365_TOKEN_PROVIDER_URL`, `OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_PROVIDER_URL`, `OPENSHELL_MICROSOFT_AGENT_S2S_TOKEN_URL`, optional `OPENSHELL_MICROSOFT_AGENT_S2S_DEFAULT_AUDIENCE` |
97100
| `nvidia` | `inference` | `NVIDIA_API_KEY` |
98101

99102
Export a built-in profile as YAML:
@@ -236,6 +239,8 @@ binaries:
236239

237240
`credentials` declares the credential names, environment variables, auth metadata, and optional refresh metadata for the provider type. The current runtime still exposes configured credential keys as placeholder environment variables and resolves placeholders in outbound HTTP requests.
238241

242+
Some provider profiles intentionally use a brokered runtime contract instead of direct credential projection. `microsoft-agent-s2s` is the built-in example. It stores `A365_BLUEPRINT_CLIENT_SECRET` and related Microsoft identity config on the gateway, injects a sandbox-local token URL into the workload, and lets the gateway mint short-lived tokens for approved audiences on demand.
243+
239244
`discovery` controls what `--from-existing` scans when
240245
`providers_v2_enabled=true`. Each entry in `discovery.credentials` must name a
241246
credential declared under `credentials`. OpenShell scans the referenced
@@ -274,6 +279,24 @@ Gateway-managed refresh strategies use these material keys:
274279

275280
OpenShell keeps token endpoints profile-owned. Refresh material cannot override `token_url` or `token_uri` during refresh configuration.
276281

282+
## Brokered Runtime Providers
283+
284+
Most Providers v2 instances still follow the placeholder injection model: the sandbox process receives a credential placeholder such as `GITHUB_TOKEN`, then the proxy resolves it in outbound HTTP traffic.
285+
286+
Brokered runtime providers are different. They keep the long-lived identity material at the gateway and inject a local token broker contract into the sandbox instead. The first built-in brokered provider is `microsoft-agent-s2s`.
287+
288+
For `microsoft-agent-s2s`:
289+
290+
- the provider instance stores `A365_BLUEPRINT_CLIENT_SECRET` as the credential
291+
- provider config stores `AZURE_TENANT_ID`, `A365_BLUEPRINT_CLIENT_ID`, `A365_RUNTIME_AGENT_ID`, and allowed audiences
292+
- the sandbox receives `A365_TOKEN_PROVIDER_URL` and related OpenShell metadata env vars
293+
- the workload calls the local URL when it needs a Microsoft bearer token
294+
- the gateway validates the attached provider and requested audience, then returns a short-lived token
295+
296+
This is useful for workloads such as Microsoft Agent 365 or NAT/A365 integrations that already expect a token callback or resolver instead of a static bearer token.
297+
298+
Brokered runtime providers do not currently imply provider-owned network policy. The built-in `microsoft-agent-s2s` profile intentionally ships without default endpoint rules, so you can pair it with the workload-specific policy or ingress model that fits your deployment.
299+
277300
## Provider Instances
278301

279302
A provider instance stores concrete credentials and config for a profile type. Built-in profile IDs and imported custom profile IDs are accepted by `--type`.

0 commit comments

Comments
 (0)