Skip to content

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

Description

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

Activity

  1. changed the title [-][Feature]: Default to `ad_token_provider` when providing Azure credential[/-] [+]Python: [Feature]: Default to `ad_token_provider` when providing Azure credential[/+] on Jan 29, 2026
  2. added
    agentsUsage: [Issues, PRs], Target: Single agent
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Jan 29, 2026
  3. added a commit that references this issue on Feb 19, 2026
    e6bbbbe
  4. added a commit that references this issue on Feb 19, 2026
    fd4e6e8
  5. moved this from In Progress to Done in Agent Frameworkon Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: Python

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions