Repository navigation
Make managed identity key attestation optional - #4004
Merged
Gladwin Johnson VR (gladjohn) merged 3 commits intoAug 26, 2026
Merged
Conversation
Move Credential Guard attestation behind an opt-in Identity Web package so ordinary certificateless and token acquisition consumers do not publish the native KeyGuard assets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c958606f-3471-4310-8715-83d1081964f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c958606f-3471-4310-8715-83d1081964f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c958606f-3471-4310-8715-83d1081964f5
Gladwin Johnson VR (gladjohn)
marked this pull request as ready for review
August 26, 2026 02:40
Nilesh Choudhary (4gust)
approved these changes
Aug 26, 2026
Bogdan Gavril (bgavrilMS)
approved these changes
Aug 26, 2026
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.
Problem
Microsoft.Identity.Web.Certificatelesscurrently referencesMicrosoft.Identity.Client.KeyAttestation. That dependency transitively brings the native-onlyMicrosoft.Azure.Security.KeyGuardAttestationpackage into applications that never request key attestation, including consumers that arrive throughMicrosoft.Identity.Web.TokenAcquisitionandMicrosoft.Identity.Web.Azure.NuGet dependencies cannot be conditioned on whether an API is used, so keeping the reference in
Certificatelessmeans every consumer receives the native DLL and PDB. It also creates compatibility problems for .NET Framework /packages.configconsumers. See AzureAD/microsoft-authentication-library-for-dotnet#6133.Change
This PR separates managed identity mTLS PoP from optional Credential Guard key attestation:
Microsoft.Identity.Web.Certificatelessindependent through theIManagedIdentityAttestationProviderextension point.Microsoft.Identity.Web.KeyAttestationpackage as the only IdWeb package that referencesMicrosoft.Identity.Client.KeyAttestation.AddMicrosoftIdentityWebKeyAttestation()for explicit opt-in.SignedAssertionFromManagedIdentity/ FIC token acquisition.Certificatelessto the optional package.Behavior
WithMtlsProofOfPossession()Microsoft.Identity.Web.KeyAttestationand callAddMicrosoftIdentityWebKeyAttestation()WithMtlsProofOfPossession()+WithAttestationSupport()Only applications that opt in receive the native KeyGuard attestation assets. The unattested managed identity mTLS PoP flow remains supported by MSAL.
For
TokenAcquirerFactoryapplications, opt-in is explicit beforeBuild():Review focus
IManagedIdentityAttestationProvideris the dependency-inversion seam; the core packages do not reference the optional implementation package.KeyAttestedManagedIdentityCredentialLoaderintentionally overrides the built-inSignedAssertionFromManagedIdentityloader through the existing custom-loader mechanism.Validation
TokenAcquirerTestsE2E project fornet8.0: 0 warnings, 0 errors.KeyAttestationTests: 2 passed.Certificateless,TokenAcquisition, andAzurepackages do not depend on KeyAttestation;Microsoft.Identity.Web.KeyAttestationdepends onMicrosoft.Identity.Client.KeyAttestation.