Forward MSAL client metadata headers through IMDS to ESTS#902
Merged
Conversation
Add x-client-SKU, x-client-Ver, and x-ms-client-request-id headers to _obtain_token_on_azure_vm() for IMDS token requests. Update existing IMDS tests to assert the new headers and validate UUID correlation IDs. Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-python/sessions/3f0bb4c2-0e45-471e-9ab3-2a502ef8cddf Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for forwarding MSAL client metadata headers
Forward MSAL client metadata headers through IMDS to ESTS
Apr 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds MSAL client metadata headers to IMDS (Azure VM / Pod Identity) token requests so IMDS can forward client telemetry to ESTS.
Changes:
- Add
x-client-SKU,x-client-Ver, andx-ms-client-request-idheaders to IMDS managed identity token requests. - Update IMDS-related unit tests to assert the presence of these headers and validate the request-id as a UUID.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
msal/managed_identity.py |
Injects MSAL SKU/version and a per-request UUID into IMDS request headers. |
tests/test_mi.py |
Updates IMDS tests to expect the new headers and validates the UUID format. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bgavrilMS
approved these changes
Apr 14, 2026
4gust
approved these changes
Apr 14, 2026
Avery-Dunn
approved these changes
Apr 14, 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.
IMDS cannot forward client telemetry to ESTS because MSAL Python never sends it. Adds three headers to IMDSv1 managed identity token requests, matching the .NET implementation (PR #5912).
Changes
msal/managed_identity.py: Addedx-client-SKU,x-client-Ver, andx-ms-client-request-idheaders to_obtain_token_on_azure_vm(). Usesx-ms-client-request-id(notclient-request-id) as IMDS requires thex-ms-prefix.tests/test_mi.py: Updated three existing IMDS test assertions (test_happy_path_of_vm,test_happy_path_of_pod_identity,test_vm_resource_id_parameter_should_be_msi_res_id) to expect the new headers. SKU is validated against a hardcoded"MSAL.Python"constant; correlation ID is validated as a well-formed UUID.Scoped to IMDS only — no changes to App Service, Arc, CloudShell, Machine Learning, or Service Fabric sources.