microsoft-authentication-cli
microsoft-authentication-cli copied to clipboard
azureauth ado token command returns PAT's which seems unexpected
There's logic in the azureauth ado token command that checks for environment variables AZUREAUTH_ADO_PAT and SYSTEM_ACCESSTOKEN.
https://github.com/AzureAD/microsoft-authentication-cli/blob/5520cb01a745f6032fb3762eed09f382c7eebe58/src/AzureAuth/Commands/Ado/CommandToken.cs#L92-L99
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?
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.