Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azureauth ado token command returns PAT's which seems unexpected #422

Open
dggsax opened this issue Feb 12, 2025 · 1 comment
Open

azureauth ado token command returns PAT's which seems unexpected #422

dggsax opened this issue Feb 12, 2025 · 1 comment

Comments

@dggsax
Copy link

dggsax commented Feb 12, 2025

There's logic in the azureauth ado token command that checks for environment variables AZUREAUTH_ADO_PAT and SYSTEM_ACCESSTOKEN.

// First attempt using a PAT.
var pat = PatFromEnv.Get(env);
if (pat.Exists)
{
logger.LogDebug($"Using PAT from env var {pat.EnvVarSource}");
logger.LogInformation(FormatToken(pat.Value, this.Output, Authorization.Basic));
return 0;
}

While returning SYSTEM_ACCESSTOKEN makes sense, I was surprised to see it returning the PAT variable if it's set, which was a little unexpected given the token subcommand. I did see a case for one of our customers where SYSTEM_ACCESSTOKEN was set to a PAT which also is unexpected.

Perhaps there could be a flag for the command to ignore environment variables?

@kyle-rader-msft
Copy link
Contributor

kyle-rader-msft commented Feb 12, 2025

SYSTEM_ACCESSTOKEN is always set to a PAT in Azure Devops Pipelines. PAT's themselves are still authentication tokens, so that is by design.

The context of the ado token command is specifically around making it easy for developer tools to run locally on developer machines and in azure devops pipelines, hence the choice for those 2 env vars. When authenticating to ADO, you can use a PAT or a JWT - both are auth tokens, they happen to use different http Header formats.

A flag to ignore them would be a fine addon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants