Skip to content

Conversation

@peombwa
Copy link
Member

@peombwa peombwa commented May 25, 2023

Fixes #2035 by ensuring we write to PowerShell's debug stream on Connect-MgGraph -Debug:

Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -UseDeviceAuthentication -Debug -ErrorAction SilentlyContinue
DEBUG: DeviceCodeCredential.Authenticate invoked. Scopes: [ User.Read ] ParentRequestId:
DEBUG: False MSAL 4.51.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [2023-05-25 00:10:59Z - 23771621-a234-4bbe-a286-fcd02e5568b2] MSAL MSAL.NetCore with assembly version '4.51.0.0'. CorrelationId(23771621-a234-4bbe-a286-fcd02e5568b2)
DEBUG: False MSAL 4.51.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [2023-05-25 00:10:59Z - 23771621-a234-4bbe-a286-fcd02e5568b2]
=== Request Data ===
Authority Provided? - True
Scopes - User.Read
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenByDeviceCode
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 23771621-a234-4bbe-a286-fcd02e5568b2
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:

DEBUG: False MSAL 4.51.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [2023-05-25 00:10:59Z - 23771621-a234-4bbe-a286-fcd02e5568b2] === Token Acquisition (DeviceCodeRequest) started:
         Scopes: User.Read
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.51.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [2023-05-25 00:10:59Z - 23771621-a234-4bbe-a286-fcd02e5568b2] [Instance Discovery] Instance discovery is enabled and will be performed
DEBUG: False MSAL 4.51.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [2023-05-25 00:10:59Z - 23771621-a234-4bbe-a286-fcd02e5568b2] [Region discovery] Not using a regional authority.
DEBUG: Request [a1a5a74a-b374-4c3c-9155-2693a0265c3d] POST https://login.microsoftonline.com/thisdomaindoesnotexist.com/oauth2/v2.0/devicecode

Changes proposed in this pull request

  • Adds AzureEventSourceListener from Azure.Identity library to write MSAL logs to PowerShell's debug stream.
  • Adds Pester test to validate the change.

Other links

@peombwa peombwa marked this pull request as ready for review May 25, 2023 00:17
@peombwa peombwa merged commit 63e0fea into features/2.0 May 25, 2023
@peombwa peombwa deleted the po/LogMsalEvents branch May 25, 2023 18:31
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.

3 participants