[Identity] Expand DAC constructor signature#46789
Draft
pvaneck wants to merge 1 commit intoAzure:mainfrom
Draft
Conversation
Make all the keyword arguments first-class for easier discoverability and more predictable behavior. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates DefaultAzureCredential (sync and async) to expose previously **kwargs-only options as explicit keyword-only constructor parameters, and refactors how credential exclusions are computed and applied (including AZURE_TOKEN_CREDENTIALS handling).
Changes:
- Expanded
DefaultAzureCredential.__init__signatures (sync/async) to make key configuration kwargs first-class parameters. - Refactored exclude-flag handling to build a
user_excludesmapping and delegate exclusion computation toprocess_credential_exclusions. - Updated
process_credential_exclusionsdocumentation to match the new calling pattern.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| sdk/identity/azure-identity/azure/identity/aio/_credentials/default.py | Makes async DefaultAzureCredential constructor parameters explicit and refactors exclusion flag handling. |
| sdk/identity/azure-identity/azure/identity/_internal/utils.py | Updates process_credential_exclusions docstring to reflect the new inputs/semantics. |
| sdk/identity/azure-identity/azure/identity/_credentials/default.py | Makes sync DefaultAzureCredential constructor parameters explicit and refactors exclusion flag handling. |
Comment on lines
+177
to
+183
| interactive_browser_tenant_id = interactive_browser_tenant_id or os.environ.get( | ||
| EnvironmentVariables.AZURE_TENANT_ID | ||
| ) | ||
| workload_identity_client_id = kwargs.pop("workload_identity_client_id", managed_identity_client_id) | ||
| workload_identity_tenant_id = kwargs.pop( | ||
| "workload_identity_tenant_id", os.environ.get(EnvironmentVariables.AZURE_TENANT_ID) | ||
| managed_identity_client_id = managed_identity_client_id or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) | ||
| workload_identity_client_id = workload_identity_client_id or managed_identity_client_id | ||
| workload_identity_tenant_id = workload_identity_tenant_id or os.environ.get( | ||
| EnvironmentVariables.AZURE_TENANT_ID |
Comment on lines
+180
to
+183
| managed_identity_client_id = managed_identity_client_id or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) | ||
| workload_identity_client_id = workload_identity_client_id or managed_identity_client_id | ||
| workload_identity_tenant_id = workload_identity_tenant_id or os.environ.get( | ||
| EnvironmentVariables.AZURE_TENANT_ID |
Comment on lines
+153
to
+159
| shared_cache_username = shared_cache_username or os.environ.get(EnvironmentVariables.AZURE_USERNAME) | ||
| shared_cache_tenant_id = shared_cache_tenant_id or os.environ.get(EnvironmentVariables.AZURE_TENANT_ID) | ||
|
|
||
| shared_cache_username = kwargs.pop("shared_cache_username", os.environ.get(EnvironmentVariables.AZURE_USERNAME)) | ||
| shared_cache_tenant_id = kwargs.pop( | ||
| "shared_cache_tenant_id", os.environ.get(EnvironmentVariables.AZURE_TENANT_ID) | ||
| managed_identity_client_id = managed_identity_client_id or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) | ||
| workload_identity_client_id = workload_identity_client_id or managed_identity_client_id | ||
| workload_identity_tenant_id = workload_identity_tenant_id or os.environ.get( | ||
| EnvironmentVariables.AZURE_TENANT_ID |
Comment on lines
+156
to
+159
| managed_identity_client_id = managed_identity_client_id or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) | ||
| workload_identity_client_id = workload_identity_client_id or managed_identity_client_id | ||
| workload_identity_tenant_id = workload_identity_tenant_id or os.environ.get( | ||
| EnvironmentVariables.AZURE_TENANT_ID |
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.
Make all the keyword arguments first-class for easier discoverability and more predictable behavior.
Closes: #45897