Skip to content

Add async MSI v2 acquisition and refresh coordination - #995

Closed
Nilesh Choudhary (4gust) wants to merge 1 commit into
feature/managed-identity-v2from
feature/async-managedidentity-v2
Closed

Nilesh Choudhary (4gust) wants to merge 1 commit into
feature/managed-identity-v2from
feature/async-managedidentity-v2

Conversation

@4gust

Copy link
Copy Markdown
Contributor

Summary

  • Add ManagedIdentityClient.open_async_session() with bounded worker-backed acquisition, capability discovery, and explicit async cleanup for MSI v2.
  • Share existing synchronous token-cache storage and partitioning; collapse matching successful cold/expired refreshes and allow valid cached tokens during proactive refresh.
  • Add cooperative acquisition cancellation while retaining resources until blocking native/HTTP operations finish.
  • Reuse the bounded worker for certificate-bound resource sessions and update documentation and the sample.

Refresh and lifetime contracts

  • Ordinary managed identity routing and the rest of MSAL remain synchronous and unchanged.
  • Failed queued acquisitions retry separately; no failure cache, cooldown, or process-wide endpoint gate is introduced.
  • Proactive fallback requires a still-usable token and its original valid binding.
  • Force refresh remints the certificate, following the inspected .NET MSI v2 behavior; explicit force/challenge paths do not use proactive fallback.
  • Sessions borrow the synchronous HTTP client and returned certificate binding; cancellation cannot forcibly interrupt an already-running blocking operation.
  • This is not yet an Azure Identity credential or an Azure async-transport adapter.

Local validation

Windows / Python 3.12:

  • Strict async suite with warnings treated as errors: 51 passed, 52 subtests passed.
  • Managed identity, token cache, and native regressions: 274 passed, 2 skipped, 818 subtests passed.
  • Deterministic concurrency subset: 25 tests repeated five times, all passed.
  • Broader offline-safe regression selection: 432 passed, 3 skipped, 836 subtests passed; external networking was blocked and no non-loopback attempts occurred in the final selection.
  • git diff --check and Python compilation passed.

Validation limits

  • Two native tests require candidate Windows native artifacts and were skipped.
  • The broader offline run excludes E2E, interactive broker, benchmarks, collection-time network checks, and tests requiring live discovery. Existing deprecation warnings remain outside the strict async suite.
  • No live IMDSv2, KeyGuard/VBS, attestation, token-service, bound-resource, cross-process, or Azure Identity integration validation; no additional Python versions validated.

Relates to #987. Targets feature/managed-identity-v2, not dev or mtls-pop.

…ation

Preserve the existing token cache while adding cooperative cancellation, proactive refresh coordination, and deterministic concurrency regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant