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
feat: replace read-only-service-connection with permissions field (#26)
Replace the single
ead-only-service-connection front matter field with a
structured permissions field that models ADO's two access levels via separate
ARM service connections:
- permissions.read: mints a read-only token for the agent (Stage 1)
- permissions.write: mints a write token for the executor (Stage 2 only)
System.AccessToken is no longer used for agent or executor operations.
Key changes:
- Add PermissionsConfig type with read/write service connection fields
- Generate separate SC_READ_TOKEN and SC_WRITE_TOKEN pipeline variables
- Add compile-time validation: fail if write safe-outputs lack permissions.write
- Update both standalone and 1ES compilers and templates
- Add Permissions step to interactive creation wizard
- Add 5 integration tests covering all permission combinations
- Update AGENTS.md documentation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
read: my-read-arm-connection # ARM service connection for read-only ADO access (Stage 1 agent)
182
+
write: my-write-arm-connection # ARM service connection for write ADO access (Stage 2 executor only)
181
183
---
182
184
183
185
@@ -568,20 +570,37 @@ Should be replaced with the description field from the front matter. This is use
568
570
569
571
## {{ acquire_ado_token }}
570
572
571
-
Generates an `AzureCLI@2` step that acquires an Azure DevOps-scoped access token from an ARM service connection. This is only generated when `read-only-service-connection` is configured in the front matter.
573
+
Generates an `AzureCLI@2` step that acquires a read-only ADO-scoped access token from the ARM service connection specified in `permissions.read`. This token is used by the agent in Stage 1 (inside the AWF sandbox).
572
574
573
575
The step:
574
-
- Uses the specified ARM service connection
576
+
- Uses the ARM service connection from `permissions.read`
575
577
- Calls `az account get-access-token` with the ADO resource ID
576
-
- Stores the token in a secret pipeline variable `SC_ACCESS_TOKEN`
578
+
- Stores the token in a secret pipeline variable `SC_READ_TOKEN`
577
579
578
-
If no `read-only-service-connection` is configured, this marker is replaced with an empty string.
580
+
If `permissions.read` is not configured, this marker is replaced with an empty string.
579
581
580
582
## {{ copilot_ado_env }}
581
583
582
-
Generates environment variable entries for the copilot AWF step when `read-only-service-connection` is configured. Sets both `AZURE_DEVOPS_EXT_PAT` and `SYSTEM_ACCESSTOKEN` to the service connection token.
584
+
Generates environment variable entries for the copilot AWF step when `permissions.read` is configured. Sets both `AZURE_DEVOPS_EXT_PAT` and `SYSTEM_ACCESSTOKEN` to the read service connection token (`SC_READ_TOKEN`).
583
585
584
-
If no `read-only-service-connection` is configured, this marker is replaced with an empty string, and ADO access tokens are omitted from the copilot invocation.
586
+
If `permissions.read` is not configured, this marker is replaced with an empty string, and ADO access tokens are omitted from the copilot invocation.
587
+
588
+
## {{ acquire_write_token }}
589
+
590
+
Generates an `AzureCLI@2` step that acquires a write-capable ADO-scoped access token from the ARM service connection specified in `permissions.write`. This token is used only by the executor in Stage 2 (`ProcessSafeOutputs` job) and is never exposed to the agent.
591
+
592
+
The step:
593
+
- Uses the ARM service connection from `permissions.write`
594
+
- Calls `az account get-access-token` with the ADO resource ID
595
+
- Stores the token in a secret pipeline variable `SC_WRITE_TOKEN`
596
+
597
+
If `permissions.write` is not configured, this marker is replaced with an empty string.
598
+
599
+
## {{ executor_ado_env }}
600
+
601
+
Generates environment variable entries for the Stage 2 executor step when `permissions.write` is configured. Sets `SYSTEM_ACCESSTOKEN` to the write service connection token (`SC_WRITE_TOKEN`).
602
+
603
+
If `permissions.write` is not configured, this marker is replaced with an empty string. Note: `System.AccessToken`is never used directly — all ADO tokens come from explicitly configured service connections.
585
604
586
605
## {{ compiler_version }}
587
606
@@ -1030,22 +1049,42 @@ network:
1030
1049
1031
1050
All hosts (core + MCP-specific + user-specified) are combined into a comma-separated domain list passed to AWF's `--allow-domains` flag.
1032
1051
1033
-
### Read-Only Service Connection
1052
+
### Permissions (ADO Access Tokens)
1034
1053
1035
-
For agents that need read-only access to Azure DevOps resources (e.g., reading repository information), you can configure an ARM service connection to provide a scoped access token:
1054
+
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.
- The pipeline mints an ADO-scoped token from the ARM service connection
1043
-
- The token is passed to the copilot via `AZURE_DEVOPS_EXT_PAT` and `SYSTEM_ACCESSTOKEN`
1044
-
- This allows the agent to authenticate to ADO APIs without using the pipeline's default System.AccessToken
1062
+
#### Security Model
1063
+
1064
+
- **`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.
1065
+
- **`permissions.write`**: Mints a write-capable ADO-scoped token used **only** by the executor in Stage 2 (`ProcessSafeOutputs` job). This token is never exposed to the agent.
1066
+
- **Both omitted**: No ADO tokens are passed anywhere. The agent has no ADO API access.
1067
+
1068
+
#### Compile-Time Validation
1069
+
1070
+
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.
1045
1071
1046
-
When not configured:
1047
-
- ADO access tokens are omitted from the copilot invocation
1048
-
- The agent cannot authenticate to ADO APIs
1072
+
#### Examples
1073
+
1074
+
```yaml
1075
+
# Agent can read ADO, safe-outputs can write
1076
+
permissions:
1077
+
read: my-read-sc
1078
+
write: my-write-sc
1079
+
1080
+
# Agent can read ADO, no write safe-outputs needed
1081
+
permissions:
1082
+
read: my-read-sc
1083
+
1084
+
# Agent has no ADO access, but safe-outputs can create PRs/work items
0 commit comments