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: site/src/content/docs/reference/network.mdx
+13-17Lines changed: 13 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,16 +109,16 @@ network:
109
109
110
110
## Permissions (ADO Access Tokens)
111
111
112
-
ADO does not support fine-grained permissions -- there are two access levels: blanket read and blanket write. Tokens are minted from ARM service connections; `System.AccessToken` is never used for agent or executor operations.
112
+
ADO does not support fine-grained permissions -- there are two access levels: blanket read and blanket write. ARM service connections are used to mint scoped tokens for the agent (`permissions.read`) and optionally for the executor (`permissions.write`). The Stage 3 executor also uses the pipeline's built-in `$(System.AccessToken)` as its default write token when no `permissions.write` override is configured.
113
113
114
-
**Exception:** The trigger filter gate step (Setup job) uses `System.AccessToken`
114
+
**Note:** The trigger filter gate step (Setup job) uses `System.AccessToken`
115
115
for two purposes: (1) self-cancelling the build when filters don't match
116
116
(`PATCH` to `_apis/build/builds/{id}`), and (2) fetching PR metadata for
117
-
Tier 2 filters (labels, draft status, changed files). This runs in the
118
-
Setup job before the agent starts, outside the AWF sandbox. The pipeline
119
-
must have "Allow scripts to access the OAuth token" enabled for this to
120
-
work. This is a deliberate scoped exception -- the token is not passed to
also uses `System.AccessToken` as its default write token. In both cases
119
+
the pipeline must have "Allow scripts to access the OAuth token" enabled.
120
+
The agent (Stage 1) **never** receives `System.AccessToken` — this trust
121
+
boundary ensures the AI agent cannot directly perform write operations.
122
122
123
123
```yaml
124
124
permissions:
@@ -129,26 +129,22 @@ permissions:
129
129
### Security Model
130
130
131
131
- **`permissions.read`**: Mints a read-only ADO-scoped token given to the agent inside the AWF sandbox (Stage 1). The agent can query ADO APIs but cannot write.
132
-
- **`permissions.write`**: Mints a write-capable ADO-scoped token used **only** by the executor in Stage 3 (`SafeOutputs` job). This token is never exposed to the agent.
133
-
- **Both omitted**: No ADO tokens are passed anywhere. The agent has no ADO API access.
134
-
135
-
### Compile-Time Validation
136
-
137
-
If write-requiring safe-outputs (`create-pull-request`, `create-work-item`) are configured but `permissions.write` is missing, compilation fails with a clear error message.
132
+
- **`permissions.write`** *(optional)*: Overrides the Stage 3 executor's default `$(System.AccessToken)` with an ARM-minted write token (`SC_WRITE_TOKEN`). Use this for cross-org or cross-project writes, or when you need the action attributed to a named service principal rather than the pipeline's build service identity.
133
+
- **Both omitted**: The agent has no ADO API access. Stage 3 still uses `$(System.AccessToken)` for write operations (sufficient for most same-project safe outputs).
138
134
139
135
### Examples
140
136
141
137
```yaml
142
-
# Agent can read ADO, safe-outputs can write
138
+
# Agent can read ADO; executor writes via $(System.AccessToken) (default)
143
139
permissions:
144
140
read: my-read-sc
145
-
write: my-write-sc
146
141
147
-
# Agent can read ADO, no write safe-outputs needed
142
+
# Agent can read ADO; executor writes via named ARM identity
148
143
permissions:
149
144
read: my-read-sc
145
+
write: my-write-sc
150
146
151
-
# Agent has no ADO access, but safe-outputs can create PRs/work items
147
+
# No ADO API read for agent; executor writes via named ARM identity
Copy file name to clipboardExpand all lines: site/src/content/docs/reference/template-markers.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -464,9 +464,10 @@ If `permissions.write` is not configured, this marker is replaced with an empty
464
464
465
465
## `{{ executor_ado_env }}`
466
466
467
-
Generates the complete `env:` block (including the `env:` key) for the Stage 3 executor step when `permissions.write` is configured. Sets `SYSTEM_ACCESSTOKEN` to the write service connection token (`SC_WRITE_TOKEN`).
467
+
Generates the complete `env:` block (including the `env:` key) for the Stage 3 executor step. This block is **always** emitted — the executor always needs `SYSTEM_ACCESSTOKEN` to authenticate ADO write operations.
468
468
469
-
If `permissions.write` is not configured, this marker is replaced with an empty string so that no `env:` block is emitted at all. Note: `System.AccessToken`is never used directly -- all ADO tokens come from explicitly configured service connections.
469
+
- When `permissions.write` **is** configured: emits `SYSTEM_ACCESSTOKEN: $(SC_WRITE_TOKEN)` (the ARM-minted write token from the service connection).
470
+
- When `permissions.write` **is not** configured (the default): emits `SYSTEM_ACCESSTOKEN: $(System.AccessToken)` — the pipeline's built-in OAuth token, sufficient for most same-project writes.
@@ -26,7 +26,7 @@ If your project already has ARM service connections with appropriate ADO permiss
26
26
27
27
## Create the write service connection
28
28
29
-
This is the minimum required connection. It powers Stage 3 safe-output execution.
29
+
The write service connection overrides the default `$(System.AccessToken)` — use it when you need writes attributed to a named service principal, or for cross-org / cross-project safe outputs where the pipeline's built-in token lacks sufficient scope.
30
30
31
31
<Steps>
32
32
1. Go to your **Azure DevOps Project → Project Settings → Service connections**
@@ -90,8 +90,8 @@ This is the minimum required connection. It powers Stage 3 safe-output execution
90
90
Only grant the permissions your workflows actually use. If your agents only create work item comments, you don't need full Contributor access. See [Safe Outputs reference](/ado-aw/reference/safe-outputs/) for what each tool requires.
91
91
:::
92
92
93
-
:::note[Compile-time safety check]
94
-
If you configure safe outputs that require write access (e.g. `create-pull-request`, `create-work-item`, `add-pr-comment`) but omit `permissions.write`, compilation will fail with a clear error. This ensures write operations always have an explicitly configured credential.
93
+
:::note[Default executor token]
94
+
The Stage 3 executor always has write access — it defaults to `$(System.AccessToken)` (the pipeline's built-in OAuth token), which is sufficient for most same-project safe outputs. A `permissions.write` service connection is only needed for cross-org writes, cross-project operations, or when you need the action attributed to a named service principal rather than the pipeline's build service identity.
95
95
:::
96
96
97
97
---
@@ -121,10 +121,10 @@ Separation ensures the Stage 1 agent — which runs untrusted AI-generated code
121
121
122
122
| Configuration | Agent can read ADO? | Safe outputs can write? |
0 commit comments