Fix IMDS token requests for managed identities#6698
Conversation
This was broken by a035ee5, which accidentally constructed the IMDS URL with a double slash at the start of the path. This is not properly routed on the server side, leading to a 404 error with some very misleading XML. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical bug in IMDS (Instance Metadata Service) token requests for managed identities that was introduced in a previous commit. The issue caused a double slash in the URL path, resulting in 404 errors and breaking managed identity authentication functionality.
- Corrected the IMDS URL path by removing the leading slash to prevent double slash formation
- Updated the changelog to document the bug fix
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/identity/azure-identity/src/managed_identity_source.cpp | Fixed IMDS URL path construction by removing leading slash |
| sdk/identity/azure-identity/CHANGELOG.md | Added changelog entry documenting the managed identity fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Thank you for your contribution @chewi! We will review the pull request and get back to you soon. |
|
#5187 suggests this shouldn't have been an issue and yet it was. Perhaps there's a gap in the logic? I imagine you'll want to accept this change anyway so that the URL is correct in the first place. |
antkmsft
left a comment
There was a problem hiding this comment.
Thank you! Ah, it's the 3rd time or so as we trip over that double slash in URL. And it wouldn't show up when WinHTTP transport is used (WinHTTP is immune to https://url.com//path), which makes it harder to reproduce.
This was broken by a035ee5, which accidentally constructed the IMDS URL with a double slash at the start of the path. This is not properly routed on the server side, leading to a 404 error with some very misleading XML.
If I'm not mistaken, managed identities are completely broken right now, so I suggest getting this fix out soon.
Pull Request Checklist