Skip to content

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

Closed

Description

@laiapat

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.

Activity

  1. added
    Client
    on Oct 15, 2021
  2. locked and limited conversation to collaborators on Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Azure.IdentityClient

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions