Skip to content
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

[BUG] VSCode Credential doesn't work #15428

Closed
mhoeger opened this issue Sep 24, 2020 · 4 comments
Closed

[BUG] VSCode Credential doesn't work #15428

mhoeger opened this issue Sep 24, 2020 · 4 comments
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team

Comments

@mhoeger
Copy link

mhoeger commented Sep 24, 2020

Describe the bug
When I use DefaultAzureCredential locally with myself logged in only via the VS Code Extension, I run into an exception.

Similar behavior and error message on Node.js SDK: Azure/azure-sdk-for-js#11452

Expected behavior
Gets token correctly

Actual behavior (include Exception or Stack Trace)

Executed 'HttpTriggerCSharp1' (Failed, Id=e75cbbd8-1af0-440c-85a5-9a0b997d23f0, Duration=10823ms) System.Private.CoreLib: Exception while executing function: HttpTriggerCSharp1. Azure.Identity: DefaultAzureCredential failed to retrieve a token from the included

credentials. - EnvironmentCredential authentication unavailable. Environment variables are not fully configured. - ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found. - SharedTokenCacheCredential authentication unavailable.

No accounts were found in the cache. - No installed instance of Visual Studio was found - VisualStudioCodeCredential authentication failed: AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter

'scope' is not valid. The scope

https://management.core.windows.net/ offline_access openid profile is not valid. The scope format is invalid. Scope must be in a valid URI form <https://example/scope> or

a valid Guid <guid/scope>. Trace ID: be3eb110-73a4-4e43-9bcf-cad29aa14100 Correlation ID: 562dd4f9-0a84-4423-8446-800f37639ee9 Timestamp: 2020-09-18 22:08:35Z

To Reproduce

  1. Use VS Code Extension
  2. Log in to Azure using VS Code Extension
  3. Run this code, using <PackageReference Include="Azure.Identity" Version="1.2.2" />
var creds = new DefaultAzureCredential();
var accessToken = creds.GetToken(new TokenRequestContext(new[] {"https://management.core.windows.net/" }));
var credentials = new TokenCredentials(accessToken.Token, "Bearer");

Workaround: Log in via az CLI

Environment:

  • Name and version of the Library package used: Azure.Identity 1.2.2
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): Windows 10 .NET Core 2 or 3
  • IDE and version : Visual Studio Code
@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 24, 2020
@AlexanderSher
Copy link
Contributor

Hi @mhoeger , do you have the same error when scope is set in valid format, e.g.: https://management.core.windows.net//.default?

@jsquire jsquire added Azure.Identity Client This issue points to a problem in the data-plane of the library. needs-author-feedback Workflow: More information is needed from author to address the issue. labels Sep 25, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 25, 2020
@mhoeger
Copy link
Author

mhoeger commented Oct 1, 2020

Hi @AlexanderSher ! Sorry for the delay. Thanks for that note - I've updated my code so that it is in a valid format. Now, I'm getting this exception:

System.Private.CoreLib: Exception while executing function: Translate. Azure.Identity: DefaultAzureCredential failed to retrieve a token from the included credentials.
- EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
- ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found.
- SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
- Operating system Darwin 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 18 21:21:34 PDT 2020; root:xnu-4570.71.82.5~1/RELEASE_X86_64 isn't supported.
- VisualStudioCodeCredential authentication unavailable. Token acquisition failed. Ensure that you have authenticated in VSCode Azure Account.
- Please run 'az login' to set up account.

I am logged in though through the Azure extension

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Oct 1, 2020
@mhoeger
Copy link
Author

mhoeger commented Oct 1, 2020

^Sorry I should specify, the original issue happened on Windows and the issue I just pasted is from a Mac. I'm guessing that this is the root cause this #14362? I'll try again on my Windows machine. Apologies for the mixup!

@christothes
Copy link
Member

This appears to be resolved. Please re-open if not.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

5 participants