Skip to content

Python: [Feature]: Default to ad_token_provider when providing Azure credential #3500

@cecheta

Description

@cecheta

Description

When using an Azure client and providing a credential, the client generates and uses a token. For long-lasting clients, the token generated may expire while the client is still being used. Could the credential instead be used to create an ad_token_provider?

Instead of:

ad_token = get_entra_auth_token(credential, token_endpoint)

do

# from azure.identity import get_bearer_token_provider

ad_token_provider = get_bearer_token_provider(credential, token_endpoint)

This way, the token provider will ensure that a new token is regenerated if it is expired.

Code Sample

Language/SDK

Python

Metadata

Metadata

Labels

agentsIssues related to single agentspythonv1.0Features being tracked for the version 1.0 GA

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions