-
Notifications
You must be signed in to change notification settings - Fork 380
ImdsV2 is detected, even on a UAMI configuration error #5581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -450,5 +450,7 @@ public static string InvalidTokenProviderResponseValue(string invalidValueName) | |
| public const string InvalidCertificate = "The certificate received from the Imds server is invalid."; | ||
| public const string CannotSwitchBetweenImdsVersionsForPreview = "ImdsV2 is currently experimental - A Bearer token has already been received; Please restart the application to receive a mTLS PoP token."; | ||
| public const string MtlsPopTokenNotSupportedinImdsV1 = "A mTLS PoP token cannot be requested because the application\'s source was determined to be ImdsV1."; | ||
| public const string IdentityNotFound = "Managed Identity not found. To request credentials for this identity, please assign it first. Please see aka.ms/ManagedIdentityNotFound for more details"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMDS already returns the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the exact error message from Imds - It's used multiple times in this PR, including test mocks, so I made it a constant. I could return the error message from Imds, but I would still keep this constant for the test mocks.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed with @gladjohn - we can depend on the error code, but the error messages should from the server. |
||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMDS throttles very aggressively on 200s, but is much more forgiving of 400s.
For that reason we want the IMDSv2 probe to have a single responsibility:
and nothing else.
Right now
GetPlatformMetadataends up hitting IMDSv2 twice, and the probe path behaves too much like a “real” call:IdentityNotFound) that we only need on the second call.We’d like to align the probe with the way Azure.Identity does it in
ImdsManagedIdentityProbeSource:Metadata: trueheader.(they throw an internal
ProbeRequestResponseExceptionand then do the real call throughMsalManagedIdentityClient).Concretely, for MSAL
Probe call
Metadataheader).IdentityNotFoundlogic here — the probe is not an identity call.Second (real) call
Metadata: true+ identity hints).IdentityNotFoundvsManagedIdentityRequestFailed.That keeps the probe cheap and stable (one responsibility: endpoint exists)
and ensures we’re not burning extra 200s against IMDS just to detect IMDSv2.
IMDS V2 probe spec - https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/main/docs/msi_v2/vm_vmss_credential_probe.md
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be tracked on a separate GitHub issue. This PR fixes the linked bug, that you were pushing me to fix, so that people using public preview are no longer blocked.
Do you remember our discussions where we decided to combine the probe and the metadata endpoint? We had that discussion very early on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are partners blocked by this, agreed to take this fix, but I am not sure there are?
Otherwise, it does seem like the 400 error is the correct fix and this can be done alongisde MSIv1 probing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While onboarding the partner we found they are using UAMI, and UAMI itself is not working in the environment. So no new partner onboarding till end of month.