Skip to content

[Identity] Multi-tenant authentication doesn't work with async ClientSecretCredential #21289

@mccoyp

Description

@mccoyp

This issue will likely also exist for any other credential that uses the async AadClient to make token requests. Passing a tenant_id kwarg to the async ClientSecretCredential's get_token method raises an error because the kwarg makes its way into a call to AsyncPipeline.run and is unexpected.

To reproduce on Python 3.10 and azure-identity 1.7.0:

import asyncio
from azure.identity.aio import ClientSecretCredential

async def run_test():
    credential = ClientSecretCredential(tenant_id="...", client_id="...", client_secret="...")
    await credential.get_token("...", tenant_id="...")

asyncio.run(run_test())

This error can be resolved by popping the tenant_id kwarg on the line before this AsyncPipeline.run call, but tenant_id most likely still needs to be provided to AadClient.obtain_token_by_* methods because it's used by _get_client_secret_request.

Metadata

Metadata

Assignees

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions