Skip to content

DefaultAzureCredential failure could be more explicit, give breadcrumbs to fix. #8041

Description

@KieranBrantnerMagee

Currently the failure reads as follows, if no env vars are populated:

azure.core.exceptions.ClientAuthenticationError: No valid token received. EnvironmentCredential: Incomplete environment configuration.. ImdsCredential: IMDS endpoint unavailable

This was not particularly enlightening to me, and made me expect that I had broken something/specified an endpoint wrong/had some network cut. The documentation ended up being perfectly clear (Here was good, Here was even better) so perhaps we could give a breadcrumb to that if nothing else.

My naïve fix would likely include a get_token wrapper at the DefaultAzureCredential level to catch the ClientAuthenticationError and supplement the message with a brief description of the nature of the credential (chaining) and perhaps a breadcrumb to our documentation. If this seems reasonable feel free to simply reassign the issue to me and I'll gladly implement.

To call out very clearly the Before/After for @mayurid:
Before:
azure.core.exceptions.ClientAuthenticationError: No valid token received. EnvironmentCredential: Incomplete environment configuration.. ImdsCredential: IMDS endpoint unavailable
After:
azure.core.exceptions.ClientAuthenticationError:
Chained credential request has failed, no valid token received.
Attempted credentials:
    EnvironmentCredential: Incomplete environment configuration.
    ImdsCredential: IMDS endpoint unavailable

Please visit the Azure identity Python SDK docs at
https://aka.ms/python-sdk-identity#defaultazurecredential
to learn what options defaultAzureCredential supports

Metadata

Metadata

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions