-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Identity] Update VSCodeCred Behavior + Broker Docs #35837
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: main
Are you sure you want to change the base?
[Identity] Update VSCodeCred Behavior + Broker Docs #35837
Conversation
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 addresses an issue where VisualStudioCodeCredential
could trigger interactive authentication prompts when the VS Code plugin is configured but the broker is unavailable. The changes ensure proper error handling and prevent unwanted interactive flows.
Key changes:
- Adds broker availability validation with clear error messages
- Sets
disableAutomaticAuthentication: true
for VS Code credential to prevent interactive prompts - Updates documentation with clearer prerequisites and troubleshooting guidance
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
sdk/identity/identity/src/msal/nodeFlows/msalPlugins.ts | Adds broker availability checks with descriptive error messages |
sdk/identity/identity/src/credentials/visualStudioCodeCredential.ts | Sets disableAutomaticAuthentication flag to prevent interactive auth |
sdk/identity/identity/test/internal/node/visualStudioCodeCredential.spec.ts | Adds test to verify disableAutomaticAuthentication behavior |
sdk/identity/identity/TROUBLESHOOTING.md | Updates troubleshooting with native dependency errors and platform support |
sdk/identity/identity/CHANGELOG.md | Documents the bug fix for VS Code credential interactive auth issue |
sdk/identity/identity-vscode/README.md | Adds prerequisites section with native dependency requirements |
sdk/identity/identity-broker/README.md | Updates platform support documentation |
Co-authored-by: Scott Addie <[email protected]>
Co-authored-by: Scott Addie <[email protected]>
@@ -194,6 +194,18 @@ function generatePluginConfiguration(options: MsalClientOptions): PluginConfigur | |||
].join(" "), | |||
); | |||
} | |||
// There is a scenario where the VSCode plugin is configured but the broker is not available (e.g., missing native dependencies). | |||
// This check ensures we throw an error and not proceed with an invalid configuration. | |||
if (vsCodeBrokerInfo.broker.isBrokerAvailable === false) { |
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.
nit: there's a lot of validation scenarios here, consider pulling them out into a separate function to ensures things are configured correctly, just for readbility
@@ -338,6 +338,9 @@ curl 'http://169.254.169.254/metadata/identity/oauth2/token?resource=https://man | |||
| Error Message | Description | Mitigation | | |||
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | |||
| Visual Studio Code Authentication is not available. | No Visual Studio Code plugin configuration is set or no Azure authentication record information was found in the VS Code configuration. | <ul><li>Ensure the [Azure Resources extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureresourcegroups) is properly installed.</li><li>Check that you have signed in through **Azure: Sign In** command. This command opens a browser window and displays a page that allows you to sign in to Azure.</li><li>Install the `@azure/identity-vscode` package with `npm install @azure/identity-vscode` command and set the plugin configuration with `useIdentityPlugin()`</li></ul> | | | |||
| Cannot open shared object file with `ERR_DLOPEN_FAILED` error code| Native dependencies are not properly installed. | <ul><li>Ensure that you are running in a supported environment. Currently, the `vsCodePlugin` is only supported on Windows and Mac OS.</li><li>Ensure the native dependencies are properly installed. Refer to our README prerequisites section for `@azure/identity-vscode`.</li></ul> | |
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.
Should this be
| Cannot open shared object file with `ERR_DLOPEN_FAILED` error code| Native dependencies are not properly installed. | <ul><li>Ensure that you are running in a supported environment. Currently, the `vsCodePlugin` is only supported on Windows and Mac OS.</li><li>Ensure the native dependencies are properly installed. Refer to our README prerequisites section for `@azure/identity-vscode`.</li></ul> | | |
| Cannot open shared object file with `ERR_DLOPEN_FAILED` error code| Native dependencies are not properly installed. | <ul><li>Ensure that you are running in a supported environment. Currently, the `vsCodePlugin` is only supported on Windows.</li><li>Ensure the native dependencies are properly installed. Refer to our README prerequisites section for `@azure/identity-vscode`.</li></ul> | |
Packages impacted by this PR
@azure/identity
@azure/identity-vscode
@azure/identity-broker
Describe the problem that is addressed by this PR
There's a scenario in which interactive authentication might show up for
VisualStudioCodeCredential
when the plugin is set but the broker is not available. This is because in MSAL implementation, a stub class instance is imported so that static imports won't throw.The PR ensures:
disableAutomaticAuthentication
is set internally forVisualStudioCodeCredential
so no interactive authentication would be requiredWhat are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
Are there test cases added in this PR? (If not, why?)
Provide a list of related PRs (if any)
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists