-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
VSCode Credential doesn't work #11452
Comments
+1! Here is my exception:
|
I need some help! For this credential, were you able to authenticate via the Azure Account Extension? https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account I'll continue investigating tomorrow! thank you for your time. |
I'm taking tomorrow off, but I'll come back to this on Monday for sure. |
Hey! So for me, if I use the VSCodeCredential, I just get the error I noted above, and it doesn't fall back to any login options. I have the extension set and logged in, but it seems to fail before reaching there even |
Hi @sadasant , thank you for the quick response, and enjoy the time off! I also have the extension installed and logged in. On my end, one thing that I have a valid scope: My exception changed to this... I tried Azure Logout and then Azure Login again
|
I was able to reproduce this issue. I'm working on it. |
After some investigation and through a chat with the team, we've spotted the exact cause of the bug, and we've found a fix! I'll be making a detailed PR soon. |
…11598) `VisualStudioCodeCredential` was not supporting multiple clouds, which can be configured. These changes automatically detect the user defined cloud, and otherwise default to the first cloud found. Fixes #11452 To test this: Using Visual Studio Code, and having the Azure Account extension installed, make a new folder, then place a package.json with the following content: ```json { "name": "identity-test", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "@azure/identity": "1.2.0-beta.1", "@azure/keyvault-keys": "^4.2.0-beta.1" } } ``` Then an `index.js` file with: ```js const identity = require("@azure/identity"); const { KeyClient } = require("@azure/keyvault-keys"); async function main() { const cred = new identity.VisualStudioCodeCredential(); const keyVaultUrl = `https://<key-vault-name>.vault.azure.net`; const client = new KeyClient(keyVaultUrl, cred); console.log(await client.listPropertiesOfKeys().next()); } main().then(console.log).catch((e) => console.error(e)); ``` Run `npm install`, then build the identity client from this PR in a local copy of this project, then copy the `dist/index.js` file into `node_modules/@azure/identity/dist/index.js`. This output makes the code above work. Without this change, it might not work by default, depending on what cloud VSCode has assigned in the settings.
Describe the bug
When trying to use the VisualStudioCodeCredential in the @azure/identity pakcage, you get an error:
Installed keytar as some online posts mentioned, didn't change the output
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The operation should succeed
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I am an ms internal engineer, feel free to reach out for more context/clarifications
The text was updated successfully, but these errors were encountered: