Skip to content

Warn about VisualStudioCodeCredential not working in error message#30385

Merged
pvaneck merged 2 commits intoAzure:mainfrom
basnijholt:VisualStudioCodeCredential-not-working
May 15, 2023
Merged

Warn about VisualStudioCodeCredential not working in error message#30385
pvaneck merged 2 commits intoAzure:mainfrom
basnijholt:VisualStudioCodeCredential-not-working

Conversation

@basnijholt
Copy link
Copy Markdown
Contributor

@basnijholt basnijholt commented May 12, 2023

Description

The VisualStudioCodeCredential has not worked at all for more than a year. I wasted quite some time in writing code, documentation, and trying to get the VisualStudioCodeCredential to work, only to find #23249 which reports it is currently not working with the Azure Account extension ≥0.9.11.

Visual Studio Code automatically updates extensions so it's reasonable to assume people are not using a 1.5 year old version of this extension.

To prevent others from having to dig around, I propose to expand the error message that is printed when DefaultAzureCredential fails.

Currently it prints:

ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Attempted credentials:
	EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot.this issue.
	ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint.
	SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
	VisualStudioCodeCredential: Failed to get Azure user details from Visual Studio Code.
	AzureCliCredential: Please run 'az login' to set up an account
	AzurePowerShellCredential: PowerShell is not installed
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.

However, with the code of this PR, it prints:

ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Attempted credentials:
	EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot.this issue.
	ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint.
	SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
	VisualStudioCodeCredential: Failed to get Azure user details from Visual Studio Code. Currently, the VisualStudioCodeCredential only works with the Azure Account extension version 0.9.11 and earlier. A long-term fix is in progress, see https://github.com/Azure/azure-sdk-for-python/issues/25713
	AzureCliCredential: Please run 'az login' to set up an account
	AzurePowerShellCredential: PowerShell is not installed
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.

About 9 months ago @billwert reported a new solution is planned (#25713), however, there seems to be no developer activity yet.

Hopefully, with this change developers will understand to not build tooling (such as I did) that depends on this functionality.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Copy Markdown
Collaborator

API change check

API changes are not detected in this pull request.

Copy link
Copy Markdown
Member

@pvaneck pvaneck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for improving the error message!

@github-actions github-actions Bot added Azure.Identity Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels May 13, 2023
@github-actions
Copy link
Copy Markdown

Thank you for your contribution @basnijholt! We will review the pull request and get back to you soon.

@pvaneck pvaneck merged commit 8e0b221 into Azure:main May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Identity Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants