Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
### New Features
- Exposed canonical OpenTelemetry tag names per metric via `MsalMetricsCatalog.CanonicalTagsByMetric` for discoverability and validation. [#6076](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/pull/6076)

### Changes
- Managed identity error messages and request-failure logs now include the detected `ManagedIdentitySource` (e.g., `AppService`, `Imds`, `ServiceFabric`) so the host-issued `Managed Identity Correlation ID` can be traced to the correct host's telemetry. [#6095](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/pull/6095)

4.85.0
======

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ protected virtual Task<ManagedIdentityResponse> HandleResponseAsync(

string message = GetMessageFromErrorResponse(response);

_requestContext.Logger.Error($"[Managed Identity] request failed, HttpStatusCode: {response.StatusCode} Error message: {message}");
_requestContext.Logger.Error($"[Managed Identity] request failed, Source: {_sourceType}, HttpStatusCode: {response.StatusCode} Error message: {message}");

MsalException exception = MsalServiceExceptionFactory.CreateManagedIdentityException(
MsalError.ManagedIdentityRequestFailed,
Expand Down Expand Up @@ -281,7 +281,10 @@ private string ExtractErrorMessageFromManagedIdentityErrorResponse(ManagedIdenti

if (!string.IsNullOrEmpty(managedIdentityErrorResponse.CorrelationId))
{
stringBuilder.Append($"Managed Identity Correlation ID: {managedIdentityErrorResponse.CorrelationId} Use this Correlation ID for further investigation.");
stringBuilder.Append(
$"Managed Identity Correlation ID: {managedIdentityErrorResponse.CorrelationId} " +
$"(issued by the '{_sourceType}' managed identity source; search that source's telemetry with this correlation ID). " +
$"Use this Correlation ID for further investigation.");
}

if (stringBuilder.Length == ManagedIdentityPrefix.Length)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ await mi.AcquireTokenForManagedIdentity(resource)
}

[TestMethod]
[DataRow("{\"statusCode\":500,\"message\":\"Error message\",\"correlationId\":\"GUID\"}", new string[] { "Error message", "GUID" })]
[DataRow("{\"message\":\"Error message\",\"correlationId\":\"GUID\"}", new string[] { "Error message", "GUID" })]
[DataRow("{\"statusCode\":500,\"message\":\"Error message\",\"correlationId\":\"GUID\"}", new string[] { "Error message", "GUID", "AppService", "managed identity source" })]
Comment thread
juliovi-1 marked this conversation as resolved.
Outdated
[DataRow("{\"message\":\"Error message\",\"correlationId\":\"GUID\"}", new string[] { "Error message", "GUID", "AppService", "managed identity source" })]
Comment thread
juliovi-1 marked this conversation as resolved.
Outdated
[DataRow("{\"error\":\"errorCode\",\"error_description\":\"Error message\"}", new string[] { "errorCode", "Error message" })]
[DataRow("{\"error_description\":\"Error message\"}", new string[] { "Error message" })]
[DataRow("{\"message\":\"Error message\"}", new string[] { "Error message" })]
Expand Down
Loading