Adds AKV Token Binding Managed Identity E2E tests#5829
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the IMDSv2 Managed Identity E2E test suite to validate Azure Key Vault (AKV) mTLS Proof-of-Possession (PoP) token acquisition and an authenticated AKV secret retrieval call using Credential Guard attestation. It also refactors resource constants for clarity.
Changes:
- Added an AKV E2E test that acquires an attested mTLS PoP token and calls an AKV secret endpoint using the binding certificate.
- Introduced an
CallAkvSecretAsynchelper to perform the token-bound mTLS HTTP call and validate the JSON response. - Renamed/refactored resource constants (
ArmScope→GraphResource, plus newAkvResource/AkvSecretUrl) and reorganizedusingdirectives.
tests/Microsoft.Identity.Test.E2e/ManagedIdentityImdsV2Tests.cs
Outdated
Show resolved
Hide resolved
bgavrilMS
reviewed
Mar 12, 2026
bgavrilMS
approved these changes
Mar 12, 2026
RyAuld
approved these changes
Mar 20, 2026
Contributor
|
Confirmed KV resource is setup correctly. |
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.
This pull request extends the managed identity tests to include support for Azure Key Vault (AKV) mTLS Proof-of-Possession (PoP) token acquisition and resource calls with attestation. It also refactors existing tests to use more descriptive resource constants and adds a helper method for AKV secret retrieval.
AKV mTLS PoP Testing Enhancements:
Added a new test method
AcquireTokenAndCallAKV_OnImdsV2_MtlsPoP_WithAttestation_Succeedsto validate mTLS PoP token acquisition and AKV secret retrieval with attestation, including certificate validation and proper error handling.Introduced the
CallAkvSecretAsynchelper method to perform authenticated mTLS calls to the AKV secret endpoint, asserting successful response and secret value presence.Resource Constant Refactoring:
Replaced the generic
ArmScopeconstant with more descriptiveGraphResource,AkvResource, andAkvSecretUrlconstants for improved clarity and maintainability in test setup.Updated existing tests to use the new
GraphResourceconstant instead ofArmScopefor managed identity token acquisition. [1] [2]Imports Organization:
usingstatements for better readability and to support new AKV test functionality.