[BUG] No way to set IsChainedCredential when constructing ChainedTokenCredential with token sources #47140
Labels
Azure.Identity
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Library name and version
Azure.Identity 1.10.4
Describe the bug
When using credential sources like AzurePowerShellCredential with a ChainedTokenCredential we are unable to leverage the exception handling logic of the Chained credential that allows it to work through the available credential sources, such as inside the AzurePowerShellCredential which throws a CredentialUnavailableException instead of whatever exception was thrown.
azure-sdk-for-net/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs
Lines 131 to 139 in b8a7f8a
This is because the
IsChainedCredential
property on TokenCredentialOptions (which classes like AzurePowerShellCredentialOptions extend from) is internal (this property gets translated into the_isChainedCredential
field on the credential sources which feed into the chained throwing logic)azure-sdk-for-net/sdk/identity/Azure.Identity/src/Credentials/TokenCredentialOptions.cs
Lines 43 to 46 in b8a7f8a
Expected behavior
As a consumer of the ChainedTokenCredential we should be able to set that our credential sources are for chaining so that if one fails the others can be tried
Actual behavior
We are unable to set this variable by hand (what I am doing instead in the meantime is to use System.Reflection to set the
_isChainedCredential
field on my Token Sources, if they have the field, before I provide them to my ChainedTokenCredential instance)Reproduction Steps
n/a
Environment
Runtime Environment:
OS Name: Mac OS X
OS Version: 14.7
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.300/
The text was updated successfully, but these errors were encountered: