Skip to content

IMDS Source Detection Logic Improvement - #5602

Merged
bgavrilMS merged 10 commits into
mainfrom
rginsburg/imds_probing
Dec 7, 2025
Merged

IMDS Source Detection Logic Improvement#5602
bgavrilMS merged 10 commits into
mainfrom
rginsburg/imds_probing

Conversation

@Robbie-Microsoft

Copy link
Copy Markdown
Contributor

Implemented ImdsV2 and ImdsV1 probing

Implements #5594

@Robbie-Microsoft
Robbie-Microsoft requested a review from a team as a code owner November 26, 2025 22:42
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ImdsManagedIdentitySource.cs Outdated
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ManagedIdentityClient.cs Outdated
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ManagedIdentityClient.cs Outdated
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ManagedIdentityClient.cs Outdated
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ManagedIdentityClient.cs Outdated
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ManagedIdentitySource.cs Outdated
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ManagedIdentityClient.cs Outdated
Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ManagedIdentityClient.cs Outdated
ManagedIdentityApplication mi = miBuilder.Build() as ManagedIdentityApplication;

Assert.AreEqual(expectedManagedIdentitySource, await mi.GetManagedIdentitySourceAsync().ConfigureAwait(false));
if (managedIdentitySource == ManagedIdentitySource.ImdsV2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a test where we first get a bearer and then request a POP token?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is currently not possible, we throw an error. We even have a unit test for this: ApplicationsCannotSwitchBetweenImdsVersionsForPreview

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.";

Comment thread src/client/Microsoft.Identity.Client/ManagedIdentity/ImdsManagedIdentitySource.cs Outdated
@Robbie-Microsoft Robbie-Microsoft linked an issue Dec 4, 2025 that may be closed by this pull request
2 tasks
@bgavrilMS
bgavrilMS merged commit 964a074 into main Dec 7, 2025
1 check passed
@bgavrilMS
bgavrilMS deleted the rginsburg/imds_probing branch December 7, 2025 14:58
bgavrilMS added a commit that referenced this pull request Dec 7, 2025
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.

[Feature Request] IMDS Source Detection Logic Improvement

3 participants