[POC] Adds MSI v2 (mTLS PoP) support: mtls_proof_of_possession and with_attestation_support APIs#877
Draft
[POC] Adds MSI v2 (mTLS PoP) support: mtls_proof_of_possession and with_attestation_support APIs#877
mtls_proof_of_possession and with_attestation_support APIs#877Conversation
… sample, and tests Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add MSI v2 support with mTLS PoP for MSAL Python
Add MSI v2 (mTLS PoP) support to MSAL Python
Feb 21, 2026
Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
Add MSI v2 (mTLS PoP) support to MSAL Python
Fix CodeQL clear-text logging alerts in msi_v2_sample.py
Feb 21, 2026
… path Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
…uire_token_for_client Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
[DRAFT] MSI v2 implementation for MSAL Python
Add MSI v2 (mTLS PoP) support with per-call Feb 21, 2026
mtls_proof_of_possession and with_attestation_support APIs
…only for legacy msi_v2_enabled path Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
Add MSI v2 (mTLS PoP) support with per-call
Add MSI v2 (mTLS PoP) support: Feb 21, 2026
mtls_proof_of_possession and with_attestation_support APIsmtls_proof_of_possession and with_attestation_support per-call APIs
mtls_proof_of_possession and with_attestation_support per-call APIsCo-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
Add MSI v2 mTLS Proof-of-Possession support to MSAL Python (per-call API + KeyGuard attestation)
Add MSI v2 (mTLS PoP) support: Feb 23, 2026
mtls_proof_of_possession and with_attestation_support APIs
mtls_proof_of_possession and with_attestation_support APIsmtls_proof_of_possession and with_attestation_support APIs
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.
POC - MSI v2
This PR adds a the Managed Identity (MSI) v2 implementation to MSAL Python, mirroring the end-to-end flow and ergonomics of MSAL .NET. It enables mTLS Proof-of-Possession (PoP) tokens via the MSI v2
/issuecredentialprotocol and (optionally) KeyGuard-backed attestation on Windows, while preserving full backwards compatibility for existing MSI v1 users.What’s included
New per-call API (opt-in)
Equivalent to MSAL .NET’s
.WithMtlsProofOfPossession()/.WithAttestationSupport()builder patterns, exposed as per-call kwargs onacquire_token_for_client():mtls_proof_of_possession=True— uses MSI v2/issuecredentialflow; otherwise MSI v1 remains unchanged.with_attestation_support=True— enables Windows KeyGuard attestation viaAttestationClientLib.dll(no-op elsewhere).New modules
msal/msi_v2.py— MSI v2 client (end-to-end)Implements the full MSI v2 flow:
1.3.6.1.4.1.311.90.2.10(cuId extension)/getplatformmetadataplatform metadata retrieval/issuecredentialcredential retrievaltoken_type=mtls_popwhere supportedverify_cnf_binding()validatescnf.x5t#S256matches the certificate SHA-256 thumbprint hashmsal/msi_v2_attestation.py— Attestation handlingAttestation integration layer:
AttestationClientLib.dllinterop viactypesfor KeyGuard attestationNone(CSR-only / non-attested operation) when KeyGuard isn’t availablemanaged_identity.pyIntegration with existing managed identity flow
msal/managed_identity.pymtls_proof_of_possession/with_attestation_supportkwargs onacquire_token_for_client()MsiV2Error(ManagedIdentityError)for MSI v2 failure semanticsmsi_v2_enabled(constructor param) and env varMSAL_ENABLE_MSI_V2are retained with original silent-fallback behavior (see contract below)msal/__init__.pyMsiV2ErrorError handling contract
mtls_proof_of_possession=True(per-call)MsiV2Errorraised — no fallbackmsi_v2_enabled=True(constructor / env var)Deliverables
sample/msi_v2_sample.py— runnable reference sample aligned to the PowerShell protocol guide (PR #5771), with step-by-step logstests/test_msi_v2.py— comprehensive tests with mocked IMDS for CI suitabilityWhy this matters
MSI v2 introduces an orchestrated, multi-hop flow (KeyGuard → attestation → IMDS → mTLS → ESTS) with many failure domains. This PR makes MSI v2 first-class in MSAL Python with:
cnf.x5t#S256)🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.