Skip to content

[WIP] Fix 2FA enforcement in azd auth login --fresh command#6691

Open
Copilot wants to merge 10 commits intomainfrom
copilot/vscode-ml5m06i3-9hw7
Open

[WIP] Fix 2FA enforcement in azd auth login --fresh command#6691
Copilot wants to merge 10 commits intomainfrom
copilot/vscode-ml5m06i3-9hw7

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Cloud agent has begun work on take the current cha... and will update this pull request as work progresses.

Original prompt

take the current changes as a fix for #6667

Open the PR describing that using azd auth login --fresh would force 2FA so people don't need to find workarounds and prevent the issue around using expired tokens from the browser.

Mention that we are using a fork while the main change AzureAD/microsoft-authentication-library-for-go#595 is approved and a new official version of MSAL lib for go is released.

Created from VS Code.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vhvb1989 vhvb1989 marked this pull request as ready for review February 2, 2026 20:20
Copilot AI review requested due to automatic review settings February 2, 2026 20:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a --fresh flag to the azd auth login command to force re-authentication and 2FA/MFA validation. This addresses issue #6667 where users were experiencing problems with expired tokens from the browser by allowing them to bypass cached credentials.

Changes:

  • Added a --fresh flag to azd auth login that forces re-authentication by setting the MSAL prompt to PromptLogin
  • Extended the LoginInteractiveOptions struct to support custom MSAL prompt types
  • Temporarily uses a forked version of the MSAL library for Go while awaiting approval of the upstream PR

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cli/azd/pkg/auth/manager.go Added Prompt field to LoginInteractiveOptions and logic to apply it during interactive authentication
cli/azd/cmd/auth_login.go Added --fresh flag handling and set PromptLogin when flag is enabled
cli/azd/go.mod Added replace directive to use forked MSAL library
cli/azd/cmd/testdata/TestUsage-azd-auth-login.snap Updated test snapshot with new --fresh flag documentation
cli/azd/cmd/testdata/TestFigSpec.ts Added --fresh flag to Fig autocomplete specification

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

azure.ai.agents - azd deploy in some cases fails with auth error despite being logged in [Issue] No subscriptions found

2 participants