[BUG] Failed to get user details from Visual Studio Code
See original GitHub issueDescribe the bug
I am trying to use DefaultAzureCredential from the azure-identity python package, but it will not work together with VS code.
I have logged into Azure in VS Code using the “Azure Account” extension. The device code login does work for my setup, but not the VisualStudioCodeCredential.
A similiar report can be found here: Azure/azure-sdk-for-net#14770. However, I am on Windows.
Expected behavior
The credential should be retrieved from VS code.
Actual behavior (include Exception or Stack Trace)
I get the exception: CredentialUnavailableError: Failed to get Azure user details from Visual Studio Code.
To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
- Use
VisualStudioCodeCredential(). - Query the Graph API using the
msgraphcorepackage.
Environment:
- Name and version of the Library package used:
azure-identity==1.5.0,msgraphcore==0.0.2 - Hosting platform or OS and .NET runtime version (
dotnet --infooutput for .NET Core projects): Windows 10 Pro, Python 3.8.3 - IDE and version : Visual Studio Code 1.54.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
Thanks for opening this issue.
VisualStudioCodeCredentialattempts to read VS Code’s settings and authentication data. One possible point of failure is that when it can’t read the settings, it assumes you’re signed in to Azure Public Cloud, and will fail to authenticate if you are not. So, first question–are you logged in to a different cloud?If not, could you please try it again with debug-level logging? For example:
That will capture the details of any exception.
Hi @kummerer94. Thank you for reaching out and we regret that you’re experiencing difficulties. I’m going to move this over to the Python SDK repository to ensure that the folks best able to assist can be looped in.