Conversation
Resolves #55501 - Add configurable WorkloadIdentityCredential tests that create credentials via IConfiguration and ConfigurableCredential instead of direct instantiation - Add creation tests for all 7 credential types validating option priority: IConfiguration > environment variable > default - Plumb IsAzureProxyEnabled through DefaultAzureCredentialOptions for WIC proxy support - Add shared CredentialCreationTestBase<T> with reflection helpers - Simplify helper by exposing config mapping and transport support
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands Azure.Identity’s test suite to validate that all supported credential types can be created via IConfiguration (through the internal ConfigurableCredential path) with the same effective option behavior as direct instantiation—especially around option precedence (config > env vars > defaults) and Workload Identity’s Azure proxy opt-in.
Changes:
- Added internal
IsAzureProxyEnabledplumbing fromIConfigurationintoDefaultAzureCredentialOptions, with clone support and factory propagation intoWorkloadIdentityCredentialOptions. - Refactored the existing
WorkloadIdentityCredentialTeststo introduce overridable factory methods, enabling a configurable-test variant to reuse the same base assertions. - Introduced a shared
CredentialCreationTestBase<T>plus multiple new “creation/priority” test classes undertests/ConfigurableCredentials/to validate configuration mapping and precedence for each credential type.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredentialOptions.cs | Reads IsAzureProxyEnabled from config and preserves it during cloning for config-based credential creation. |
| sdk/identity/Azure.Identity/src/DefaultAzureCredentialFactory.cs | Propagates IsAzureProxyEnabled into WorkloadIdentityCredentialOptions when creating a WIC via DAC/config path. |
| sdk/identity/Azure.Identity/tests/WorkloadIdentityCredentialTests.cs | Adds virtual factory methods and exposes temp-file helper to enable reuse by configurable credential tests. |
| sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs | Updates MSAL-client-type detection to unwrap ConfigurableCredential so shared MSAL-oriented base tests work with configurable credentials. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/ConfigurableCredentialTestHelper.cs | Adds Castle proxy unwrapping and transport injection support for configurable credential tests. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/CredentialCreationTestBase.cs | New shared base for config-driven credential creation + reflection helpers used by option-precedence tests. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/WorkloadIdentityCredentialTests.cs | New configurable variant of the WIC test suite that creates credentials via IConfiguration. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/WorkloadIdentityCredentialCreationTests.cs | New option precedence and mapping tests for WorkloadIdentityCredentialOptions (including Azure proxy behavior). |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/AzureCliCredentialCreationTests.cs | New option precedence tests for Azure CLI credential creation via config. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/AzurePowerShellCredentialCreationTests.cs | New option precedence tests for Azure PowerShell credential creation via config. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/AzureDeveloperCliCredentialCreationTests.cs | New option precedence tests for Azure Developer CLI credential creation via config. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/VisualStudioCredentialCreationTests.cs | New option precedence tests for Visual Studio credential creation via config. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/VisualStudioCodeCredentialCreationTests.cs | New option precedence tests for Visual Studio Code credential creation via config. |
| sdk/identity/Azure.Identity/tests/ConfigurableCredentials/EnvironmentCredentialCreationTests.cs | New option precedence tests for Environment credential creation via config (authority host, tenants, etc.). |
jsquire
approved these changes
Feb 12, 2026
Member
Author
|
/check-enforcer override |
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.
Resolves #55501
What this PR does
Adds comprehensive test coverage for creating Azure Identity credentials via IConfiguration and the internal ConfigurableCredential class, ensuring both direct instantiation and configuration-based creation paths produce identical behavior.
Changes
Source (2 files):
Test infrastructure (3 files modified):
New test files (9 files):
Total: 92 creation tests + 56 configurable WIC tests, all passing