Skip to content

[Identity] Expand DAC constructor signature#46789

Draft
pvaneck wants to merge 1 commit intoAzure:mainfrom
pvaneck:identity-method-signature
Draft

[Identity] Expand DAC constructor signature#46789
pvaneck wants to merge 1 commit intoAzure:mainfrom
pvaneck:identity-method-signature

Conversation

@pvaneck
Copy link
Copy Markdown
Member

@pvaneck pvaneck commented May 8, 2026

Make all the keyword arguments first-class for easier discoverability and more predictable behavior.

Closes: #45897

Make all the keyword arguments first-class for easier discoverability
and more predictable behavior.

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_excludes mapping and delegate exclusion computation to process_credential_exclusions.
  • Updated process_credential_exclusions documentation 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

docs: clarify DefaultAzureCredential behavior when managed_identity_client_id=None

2 participants