TokenAcquisition still using the old LogCallback .WithLogging API to expose the internal logging of MSAL, instead of the newer IIdentityLogger based overload that supports somewhat more structured logging.
|
ConfidentialClientApplicationBuilder builder = ConfidentialClientApplicationBuilder |
|
.CreateWithApplicationOptions(mergedOptions.ConfidentialClientApplicationOptions) |
|
.WithHttpClientFactory(_httpClientFactory) |
|
.WithLogging( |
|
Log, |
|
ConvertMicrosoftExtensionsLogLevelToMsal(_logger), |
|
enablePiiLogging: mergedOptions.ConfidentialClientApplicationOptions.EnablePiiLogging) |
|
.WithExperimentalFeatures(); |
|
ManagedIdentityApplicationBuilder miBuilder = ManagedIdentityApplicationBuilder |
|
.Create(managedIdentityId) |
|
.WithLogging( |
|
Log, |
|
ConvertMicrosoftExtensionsLogLevelToMsal(_logger), |
|
enablePiiLogging: enablePiiLogging); |
The same is also true of Microsoft.Identity.Web.Certificateless's ManagedIdentityClientAssertion class (which amusingly ends up with a logger Source context of Microsoft.Identity.Web.DefaultCertificateLoader, despite the assembly name):
|
builder = builder.WithLogging(Log, ConvertMicrosoftExtensionsLogLevelToMsal(_logger), enablePiiLogging: false); |
This results in log lines whose message portions look like the following:
False MSAL 4.83.1.0 MSAL.NetCore .NET 10.0.7 Microsoft Windows 10.0.26200 [2026-05-18 16:29:25Z - OMITTING_CORRELATION _GUID] === Token Acquisition (ConfidentialAuthCodeRequest) started: Scopes: Authority Host: login.microsoftonline.com
Elsewhere Microsoft.Identity.Web has been using IIdentityLogger via IdentityLoggerAdapter from Microsoft.IdentityModel.LoggingExtensions. If it is feasible to switch TokenAcquisition and ManagedIdentityClientAssertion over to using IdentityLoggerAdapter, I would appreciate it.
TokenAcquisition still using the old LogCallback
.WithLoggingAPI to expose the internal logging of MSAL, instead of the newerIIdentityLoggerbased overload that supports somewhat more structured logging.microsoft-identity-web/src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquisition.cs
Lines 1098 to 1105 in de4fd49
microsoft-identity-web/src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquisition.ManagedIdentity.cs
Lines 101 to 106 in de4fd49
The same is also true of Microsoft.Identity.Web.Certificateless's ManagedIdentityClientAssertion class (which amusingly ends up with a logger Source context of
Microsoft.Identity.Web.DefaultCertificateLoader, despite the assembly name):microsoft-identity-web/src/Microsoft.Identity.Web.Certificateless/ManagedIdentityClientAssertion.cs
Line 99 in de4fd49
This results in log lines whose message portions look like the following:
Elsewhere Microsoft.Identity.Web has been using
IIdentityLoggerviaIdentityLoggerAdapterfromMicrosoft.IdentityModel.LoggingExtensions. If it is feasible to switchTokenAcquisitionandManagedIdentityClientAssertionover to using IdentityLoggerAdapter, I would appreciate it.