-
Notifications
You must be signed in to change notification settings - Fork 275
feat: support broker authentication for VSC and CLI #14925
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
base: dev
Are you sure you want to change the base?
feat: support broker authentication for VSC and CLI #14925
Conversation
a698680 to
84aa3cc
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #14925 +/- ##
========================================
Coverage 89.44% 89.44%
========================================
Files 605 606 +1
Lines 37157 37210 +53
Branches 7449 7602 +153
========================================
+ Hits 33236 33284 +48
- Misses 1836 1838 +2
- Partials 2085 2088 +3
🚀 New features to boost your workflow:
|
There was a problem hiding this 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 broker authentication support to enable more secure authentication flows for Microsoft 365 logins in VSCode extension and CLI. The changes implement Windows Authentication Broker (WAM) support using MSAL's native broker plugin for improved user authentication experience.
Key Changes
- Integrated
@azure/msal-node-extensionsto enable broker-based authentication on Windows - Added fallback logic between broker and browser authentication flows
- Implemented platform-specific native module handling for keytar and msal-node-runtime
- Created utility functions for token cache management
Reviewed changes
Copilot reviewed 23 out of 41 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/vscode-extension/src/commonlib/m365Login.ts |
Added broker plugin configuration with Windows platform check |
packages/vscode-extension/src/commonlib/codeFlowLogin.ts |
Implemented new loginWithBroker method and refactored token acquisition logic |
packages/vscode-extension/src/commonlib/common/tokenCacheUtils.ts |
Added utility function for account lookup by homeAccountId |
packages/vscode-extension/esbuild.mjs |
Added native module copying for Windows MSAL binaries |
packages/vscode-extension/packageMocks/keytar/* |
Created mock keytar implementation to avoid native module issues |
packages/vscode-extension/package.json |
Added msal-node-extensions dependency and enabled nativeWindowHandle API |
packages/fx-core/src/common/featureFlags.ts |
Added BrokerAuth feature flag |
pnpm-workspace.yaml |
Added keytar to onlyBuiltDependencies |
Files not reviewed (2)
- packages/api/pnpm-lock.yaml: Language not supported
- packages/fx-core/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation file changes should be removed.
Support authentication in broker for following flows:
ADO: https://msazure.visualstudio.com/Microsoft%20Teams%20Extensibility/_workitems/edit/33871096/?view=edit
Screenshots:
Details
1> Introduced
@azure/msal-node-extensionpackage to add NativeBrokerPlugin for broker authentication support for both VSC and CLI2> Added a feature toggle to control whether it's applying browser or broker auth
3> Added package mocks for
keytarsince it's not needed but required by the@azure/msal-node-extensionpackage. Also updated UT mocks to by passkeytarloading4> Bundle native node modules for
@azure/msal-node-extensionpackage including .node and .dll files into VSC extension5> Upgraded APIs for auth code flow since the legacy API doesn't support broker auth
6> Upgraded typescript and ts node packages for compatibility