Skip to content

DefaultAzureCredential does not work for exclude_interactive_browser_credential = False #11548

@robwe

Description

@robwe
  • Package Name: identity
  • Package Version: 1.4.0b4
  • Operating System:
  • Python Version:

Describe the bug
When DefaultAzureCredential is created with exclude_interactive_browser_credential = False then an InteractiveBrowserCredential is created with no arguments. This means that it defaults to the "organizations" tenant, because that is what MsalCredential uses, if "tenant_id" is not passed as key word argument.
As a consequence tokens can be requested only for the "organizations" tenant, but not for the user's tenant of choice.

Expected behavior
When using DefaultAzureCredential with exclude_interactive_browser_credential = False, then it must be possible to specify a tenant, like e.g. for SharedTokenCacheCredential.

Additional context
The fix is in DefaultAzureCredential__init__() to add
ibc_tenant_id = kwargs.pop("interactive_browser_credential_tenant_id", os.environ.get(EnvironmentVariables.AZURE_TENANT_ID))
and then to call
credentials.append(InteractiveBrowserCredential(tenant_id=ibc_tenant_id))
and to add to the documentation that for exclude_interactive_browser_credential = False
additionally interactive_browser_credential_tenant_id should be passed, if the default "organizations" is not appropriate.

Metadata

Metadata

Assignees

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions