Skip to content

Support forwarding MSAL client metadata headers through IMDS to ESTS#5912

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/support-forwarding-msal-metadata
Draft

Support forwarding MSAL client metadata headers through IMDS to ESTS#5912
Copilot wants to merge 2 commits intomainfrom
copilot/support-forwarding-msal-metadata

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

IMDSv1 managed identity token requests only sent Metadata: true — IMDS couldn't forward client metadata to ESTS because the headers were never sent.

Changes

  • ImdsManagedIdentitySource.CreateRequestAsync() — Adds three client metadata headers to every IMDSv1 token request:

    • x-client-SKU → platform product name via PlatformProxy.GetProductName()
    • x-client-Ver → MSAL assembly version via MsalIdHelper.GetMsalVersion()
    • client-request-id → correlation GUID from _requestContext.CorrelationId
  • MockHttpManagerExtensions (IMDS case) — Adds PresentRequestHeaders for the three new headers, so all existing IMDS mock-based tests now implicitly validate their presence.

  • ImdsTests — New test Imds_ClientMetadataHeaders_AreSentWithRequest_Async explicitly asserts header presence and correct values (SKU/Ver matched against MsalIdHelper, correlation ID validated as a GUID).

No changes to IMDSv2, CloudShell, AppService, or any other managed identity source.

Testing

Unit tests added in ImdsTests.cs. All 14 existing IMDS tests and 160 ManagedIdentityTests pass.

Performance impact

Negligible — three additional string assignments per IMDSv1 request.

Documentation

  • All relevant documentation is updated.

Copilot AI requested review from Copilot and removed request for Copilot April 7, 2026 20:59
Copilot AI changed the title [WIP] Support forwarding MSAL client metadata headers through IMDS to ESTS Support forwarding MSAL client metadata headers through IMDS to ESTS Apr 7, 2026
Copilot AI requested a review from neha-bhargava April 7, 2026 21:00
Copy link
Copy Markdown
Contributor

@gladjohn gladjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good @neha-bhargava

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.

[Engineering task] Support forwarding MSAL client metadata headers through IMDS (classic) to ESTS

3 participants