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

Upgrade AzureauthCliCredential to latest TokenCredential trait and use TokenCache #1575

Merged

Conversation

kyle-rader-msft
Copy link
Contributor

@kyle-rader-msft kyle-rader-msft commented Jan 12, 2024

This PR fixes up the AzureauthCliCredential with a few changes:

  • The credential only builds behind feature flag azureauth_cli, but this was accidentally used in code with a dash (-) rather than a underscore (_). This is updated.
  • The TokenCache was added as a more internal means of in-memory token caching, but the updates made to AzureauthCliCredential didn't build.
  • The TokenCredential trait was updated, so we update the implementation for AzureauthCliCredential.
  • Checking the version of AzureAuth before attempting to get an access token is slow, and doubles the time it takes to get your token which impacts developer command line tools quite a lot (anywhere from 600ms-2Kms). Switch from trying to use azureauth --version to using which azureauth.exe and fall back to azureauth.
  • To ensure this all works I've added a corresponding example similar to the azure cli example. This example doesn't hardcode a client or tenant, only the AzureDevops Application ID (the default scope).

I've built and ran the example CLI confirming the azureauth usage works on the following platforms:

  • Windows (x64)
  • WSL (x64)
  • Mac (arm64)

@demoray demoray merged commit decf450 into Azure:main Jan 16, 2024
22 checks passed
@kyle-rader-msft kyle-rader-msft deleted the user/kyrader/fix-azureauth-cli-cred branch January 16, 2024 19:56
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

Successfully merging this pull request may close these issues.

None yet

2 participants