Skip to content

Commit 8dd9a08

Browse files
authored
feat: log OAuth setup guide if System.AccessToken is undefined (#587)
1 parent 2d7f8b1 commit 8dd9a08

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Auth: Add helpful log message if OIDC is used but OAuth is not enabled for the agent."
4+
}

src/lib/awsConnectionParameters.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ export async function getOIDCToken(connectedService: string): Promise<string> {
477477
const token = tl.getVariable('System.AccessToken')
478478

479479
if (token == undefined) {
480-
throw new Error('System.AccessToken is undefined')
480+
throw new Error(
481+
'System.AccessToken is undefined. Ensure that you have enabled OAuth token access for your pipeline/agent job: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=classic#systemaccesstoken'
482+
)
481483
}
482484

483485
const authHandler = getHandlerFromToken(token)

0 commit comments

Comments
 (0)