Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MSAL information loged when Dependcy injecting EmailClient #47905

Open
MeetPlayWin opened this issue Jan 20, 2025 · 3 comments
Open

[BUG] MSAL information loged when Dependcy injecting EmailClient #47905

MeetPlayWin opened this issue Jan 20, 2025 · 3 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Communication - Email customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@MeetPlayWin
Copy link

Library name and version

Azure.Communication.Email v1.01

Describe the bug

Injecting the EmailClient causes logs from MSAL for graph packages to be logged.

Expected behavior

MSAL logs from other graph packages should not be logged.

Actual behavior

MSAL logs are logged.

[2025-01-20T20:20:35.882Z] False MSAL 4.66.2.0 MSAL.NetCore .NET 8.0.4 Microsoft Windows 10.0.22631 [2025-01-20 20:20:35Z - d6debb3b-3798-4d91-8e96-e541d41c3636]
[2025-01-20T20:20:35.887Z] === Request Data ===
[2025-01-20T20:20:35.891Z] Authority Provided? - True
[2025-01-20T20:20:35.895Z] Scopes - https://graph.microsoft.com/.default
[2025-01-20T20:20:35.899Z] Extra Query Params Keys (space separated) -
[2025-01-20T20:20:35.907Z] ApiId - AcquireTokenForClient
[2025-01-20T20:20:35.911Z] IsConfidentialClient - True
[2025-01-20T20:20:35.916Z] SendX5C - False
[2025-01-20T20:20:35.922Z] LoginHint ? False
[2025-01-20T20:20:35.927Z] IsBrokerConfigured - False
[2025-01-20T20:20:35.932Z] HomeAccountId - False
[2025-01-20T20:20:35.934Z] CorrelationId - d6debb3b-3798-4d91-8e96-e541d41c3636
[2025-01-20T20:20:35.939Z] UserAssertion set: False
[2025-01-20T20:20:35.943Z] LongRunningOboCacheKey set: False
[2025-01-20T20:20:35.947Z] Region configured:
[2025-01-20T20:20:35.955Z]

[2025-01-20T20:20:35.990Z] False MSAL 4.66.2.0 MSAL.NetCore .NET 8.0.4 Microsoft Windows 10.0.22631
[2025-01-20 20:20:35Z - d6debb3b-3798-4d91-8e96-e541d41c3636]
[2025-01-20T20:20:35.994Z] [LogMetricsFromAuthResult] Cache Refresh Reason: NotApplicable
[2025-01-20T20:20:35.996Z] [LogMetricsFromAuthResult] DurationInCacheInMs: 0
[2025-01-20T20:20:35.998Z] [LogMetricsFromAuthResult] DurationTotalInMs: 3
[2025-01-20T20:20:36.002Z] [LogMetricsFromAuthResult] DurationInHttpInMs: 0
[2025-01-20T20:20:36.007Z] False MSAL 4.66.2.0 MSAL.NetCore .NET 8.0.4 Microsoft Windows 10.0.22631
[2025-01-20 20:20:35Z - d6debb3b-3798-4d91-8e96-e541d41c3636] TokenEndpoint: ****
[2025-01-20T20:20:36.012Z] ClientSecretCredential.GetToken succeeded. Scopes: [ https://graph.microsoft.com/.default ] ParentRequestId: ExpiresOn: 2025-01-21T20:20:13.1153530+00:00

Reproduction Steps

       services.AddAzureClients(b =>
       {
           b.AddEmailClient(new Uri(SharedEnvironmentVariables.CommunicationServiceEndpoint))
            .WithCredential(new ChainedTokenCredential(
                    new ManagedIdentityCredential(clientId: SharedEnvironmentVariables.CommunicationServiceUserAssignedClientId),
                    new VisualStudioCredential()));
       });

    public ExceptionHandlerMiddleware(ILoggerFactory loggerFactory, EmailClient emailClient)
    {
        _logger = loggerFactory.CreateLogger<ExceptionHandlerMiddleware>();
        _emailClient = emailClient;
    }

Environment

.NET 8, Azure Function AppService, Azure Function v4

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 20, 2025
@jsquire jsquire self-assigned this Jan 21, 2025
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. Communication - Email labels Jan 21, 2025
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 21, 2025
@jsquire
Copy link
Member

jsquire commented Jan 21, 2025

Hi @MeetPlayWin. Thank you for reaching out. This behavior is by design, as the Microsoft.Extensions.Azure package includes integration with the ASP.NET DI and logging frameworks. When in use, Azure SDK logs are captured and forwarded to the registered ILogger instance. Log levels and sources can be tuned using the ASP.NET configuration in the same manner as other log sources. More context and discussion can be found in Logging with the Azure SDK for .NET.

@jsquire jsquire added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. labels Jan 21, 2025
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 21, 2025
Copy link

Hi @MeetPlayWin. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

@github-actions github-actions bot removed the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Jan 21, 2025
@jsquire jsquire added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Jan 21, 2025
Copy link

Hi @MeetPlayWin. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Communication - Email customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants