[Identity] Improve WorkloadIdentityCredential/DAC diagnosability - #42346
Merged
Conversation
pvaneck
force-pushed
the
identity-workload-identity
branch
from
August 4, 2025 23:26
ff21cfe to
a812205
Compare
pvaneck
force-pushed
the
identity-workload-identity
branch
from
August 4, 2025 23:29
a812205 to
420d0b8
Compare
pvaneck
marked this pull request as ready for review
August 4, 2025 23:56
pvaneck
requested review from
anannya03,
chlowell,
christothes,
maorleger,
minhanh-phan and
scottaddie
August 4, 2025 23:56
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves error diagnostics for the WorkloadIdentityCredential within the DefaultAzureCredential chain by introducing a substitute credential mechanism that captures initialization errors and reports them in the final error message when credential acquisition fails.
- Introduces
FailedDACCredentialandAsyncFailedDACCredentialclasses to capture and report initialization errors - Updates error message generation logic to use custom credential names from failed credential instances
- Modifies
WorkloadIdentityCredentialerror handling to provide more informative error messages with troubleshooting guidance
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
azure/identity/_credentials/default.py |
Adds FailedDACCredential class and error handling for WorkloadIdentityCredential initialization |
azure/identity/aio/_credentials/default.py |
Adds async version AsyncFailedDACCredential and corresponding error handling |
azure/identity/_credentials/workload_identity.py |
Updates error messages to use standardized format with troubleshooting guidance |
azure/identity/aio/_credentials/workload_identity.py |
Updates async version with same standardized error messages |
azure/identity/_credentials/chained.py |
Modifies error message generation to support custom credential names |
tests/test_default.py |
Adds comprehensive tests for the new failed credential functionality |
tests/test_default_async.py |
Adds async tests for the new failed credential functionality |
CHANGELOG.md |
Documents the improvement in diagnostics |
xiangyan99
reviewed
Aug 5, 2025
xiangyan99
approved these changes
Aug 5, 2025
The goal here is to have WorkloadIdentityCredential be reported in the the final error message as an attempted credential. A substitute credential for credentials that fail to construct has been added and used in the WorkloadIdentityCredential case. This will allow the reason WorkloadIdentityCredential can't be used to be propagated to the user. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pvaneck
force-pushed
the
identity-workload-identity
branch
from
August 5, 2025 17:34
086953f to
6aab953
Compare
xiangyan99
approved these changes
Aug 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The goal here is to have
WorkloadIdentityCredentialbe reported in the final error message as an attempted credential.A substitute credential for credentials that fail to construct has been added and used in the
WorkloadIdentityCredentialcase. This will allow the reasonWorkloadIdentityCredentialcan't be used to be propagated to the user.An error message like the following will now be printed with the reason WorkloadIdentityCredential was not attempted.
Closes: #42075