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

[rush] Add ChainedCredential to AzureAuthenticationBase to handle auth failover and add support for developer tools credentials #5169

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

bmiddha
Copy link
Member

@bmiddha bmiddha commented Mar 21, 2025

Summary

Implement credential failover with ChainedTokenCredential from @azure/identity.
Add support for VisualStudioCodeCredential, AzureCliCredential, AzureDeveloperCliCredential, and AzurePowerShellCredential. These can help reduce or eliminate the interactive browser popups or device code prompts, which can be annoying.

Details

Implement credential failover with ChainedTokenCredential from @azure/identity
New default credential failover order:
AdoCodespacesAuthCredential
VisualStudioCodeCredential
AzureCliCredential
AzureDeveloperCliCredential
AzurePowerShellCredential
InteractiveBrowserCredential
DeviceCodeCredential

Add support for new login flows VisualStudioCodeCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential.

Updated AdoCodespacesAuthCredential to throw CredentialUnavailableError to play nicely with the chaining.

How it was tested

Manually tested in a repo that uses Azure backed build cache.

Impacted documentation

@bmiddha bmiddha changed the title [rush] Add chained credential to support failover and add support for developer tools credentials [rush] Implement login failover with ChainedTokenCredential and add support for developer tools credentials Mar 27, 2025
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor bit of cleanup left.

@bmiddha bmiddha changed the title [rush] Implement login failover with ChainedTokenCredential and add support for developer tools credentials [rush] Add ChainedCredential to AzureAuthenticationBase to handle auth failover and add support for developer tools credentials Mar 27, 2025
@@ -35,7 +35,9 @@ export abstract class AzureAuthenticationBase {
// (undocumented)
deleteCachedCredentialsAsync(terminal: ITerminal): Promise<void>;
// (undocumented)
protected readonly _failoverOrder: Record<LoginFlowType, LoginFlowType | undefined>;
protected readonly _failoverOrder: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated types here to allow for a subset of LoginFlowType keys to be defined in the Record.
else, bumping rush version would break type checks if only some of the LoginFlowTypes were defined in the record.

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

Successfully merging this pull request may close these issues.

3 participants