Include ManagedIdentitySource in managed identity error messages and request-failure logs#6098
Closed
Robbie-Microsoft with Copilot wants to merge 2 commits into
Closed
Include ManagedIdentitySource in managed identity error messages and request-failure logs#6098Robbie-Microsoft with Copilot wants to merge 2 commits into
Robbie-Microsoft with Copilot wants to merge 2 commits into
Conversation
…request-failure logs
Copilot
AI
changed the title
[WIP] Add ManagedIdentitySource to managed identity error messages and request-failure logs
Include ManagedIdentitySource in managed identity error messages and request-failure logs
Jul 1, 2026
Robbie-Microsoft
marked this pull request as ready for review
July 1, 2026 19:24
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves managed identity failure diagnostics by including the detected ManagedIdentitySource (e.g., AppService, Imds) in both request-failure logs and correlation-ID-bearing error messages, making it easier to route the host-issued correlation ID to the correct telemetry system during incident triage.
Changes:
- Added managed identity source information to the managed identity “request failed” log line.
- Enhanced correlation-ID error message text to attribute the correlation ID to the detected managed identity source.
- Updated/added unit tests to assert the new attribution text for both AppService and IMDS sources, and documented the change in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Microsoft.Identity.Test.Unit/ManagedIdentityTests/ManagedIdentityTests.cs | Updates existing parsing assertions and adds a new parametrized regression test to validate correlation-ID attribution across MI sources. |
| src/client/Microsoft.Identity.Client/ManagedIdentity/AbstractManagedIdentity.cs | Includes _sourceType in the failure log and in the correlation-ID error-message branch. |
| CHANGELOG.md | Documents the diagnostic-message/log enhancement under the current version section. |
Robbie-Microsoft
enabled auto-merge (squash)
July 1, 2026 19:46
bgavrilMS
requested changes
Jul 1, 2026
bgavrilMS
left a comment
Member
There was a problem hiding this comment.
Doesn't preserve attribution.
Contributor
|
Superseded by #6101, which carries @juliovi-1's original commits cherry-picked unchanged so he remains the git author (this PR rewrote the code and did not preserve authorship). Closing in favor of #6101. |
auto-merge was automatically disabled
July 1, 2026 20:43
Pull request was closed
Robbie-Microsoft
deleted the
copilot/add-managed-identity-source-error-messages
branch
July 1, 2026 20:46
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.
Managed identity auth failures surface a host-issued correlation ID, but neither the error message nor the request-failure log identified which managed identity source (AppService, Imds, ServiceFabric, etc.) produced it — making live-site triage ambiguous across host telemetry systems.
Changes proposed in this request
AbstractManagedIdentity.cs_sourceType:_sourceTypefield — no hardcoding, reflects the host detected at runtime.CHANGELOG.md— added### Changesentry under the in-progress version.Testing
[DataRow]entries inManagedIdentityTestErrorResponseParsingto assert the new source attribution phrase appears in the error message for correlation-ID-bearing responses.ManagedIdentityErrorMessageAttributesCorrelationIdToSourceAsync— parametrized overAppServiceandImdssources — to guard the correlation-ID attribution branch against regression across non-AppService sources. Asserts the full composed phrase (not just the source name) to prevent false passes from echoed error bodies.No behavioral or auth changes — message/log content only. No public API surface changes.
Performance impact
None — string interpolation on an already-allocated error path.
Documentation
Co-authored-by: juliovi-1 126522119+juliovi-1@users.noreply.github.com