Skip to content

Conversation

@Robbie-Microsoft
Copy link
Contributor

@Robbie-Microsoft Robbie-Microsoft commented Dec 9, 2025

This should also fix the flaky test related to Imds Probe Cancellation Token

Fixes #5565

@Robbie-Microsoft Robbie-Microsoft requested a review from a team as a code owner December 9, 2025 17:23
{
requestContext.Logger.Info($"[Managed Identity] {imdsStringHelper} probe endpoint failure. Exception occurred while sending request to probe endpoint: {ex}");
return false;
throw new MsalServiceException(
Copy link
Member

Choose a reason for hiding this comment

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

How about this:

  1. Let cancellation exceptions pass through
  2. Capture the messages why IMDS1 and IMDS2 probe failed and output them when app calls AcquireToken() . Smth like "Cannot acquire a token for managed identity. IMDSv1 discovery failed with xyz and IMDSv2 discovery failed with bar"

Copy link
Member

@bgavrilMS bgavrilMS Dec 12, 2025

Choose a reason for hiding this comment

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

@christothes - do you need the new GetSourceAsync API to also return to you why IMDSv1 and IMDSv2 probes failed when we return Source.None ?

Choose a reason for hiding this comment

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

If we are able to pass the failure reason back to the caller, it would be better to have it at GetSourceAsync than at GetToken. For DefaultAzureCredential, it will determine if we skip managed identity alltogether.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, let's return an object then @Robbie-Microsoft that has the enum and the failures of IDMSv2 and IMDSv1

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.

[Bug] IMDS v2 fails to detect source correctly when identity not found

5 participants