fix(authentication-azure): preserve caller-owned async credentials - #732
Merged
Vincent Biret (baywet) merged 1 commit intoSep 11, 2026
Conversation
|
Vincent Biret (baywet)
approved these changes
Sep 11, 2026
Vincent Biret (baywet)
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution!
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues were identified, and validation covers the credential lifetime changes.
Pull request overview
Preserves caller-owned async Azure credentials for reuse and concurrent requests, while documenting caller-managed cleanup.
Changes:
- Removed implicit credential closure.
- Added regression tests for reuse, sharing, and concurrency.
- Documented credential lifetime responsibilities.
File summaries
| File | Description |
|---|---|
packages/authentication/azure/tests/test_azure_identity_access_token_provider.py |
Tests credential reuse and concurrency. |
packages/authentication/azure/README.md |
Documents caller-managed cleanup. |
packages/authentication/azure/kiota_authentication_azure/azure_identity_access_token_provider.py |
Preserves credential lifetime. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



AzureIdentityAccessTokenProvidercloses an async credential immediately after retrieving a token. Reusing that credential for a later request, sharing it across providers, or acquiring tokens concurrently can then fail because its transport is already closed.Leave the caller-owned credential open after token acquisition, matching the synchronous path. Document that the application must close it after all clients have finished, using its async context manager or
await credential.close().Validation (Python 3.12):
pytest -q— 21 passed.git diff --checkpassed.suggestion-modeconfiguration option.Closes #528. Related lifetime discussion: #365.
Prepared with AI assistance; reproduction and validation ran locally.