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

Add Verbose or Debug log to indicate which credential was selected #85

Open
JustinGrote opened this issue Aug 20, 2024 · 4 comments
Open

Comments

@JustinGrote
Copy link

image

@PalmEmanuel
Copy link
Owner

Good idea 👍

@PalmEmanuel
Copy link
Owner

Looks like I can pick up the events fairly easily and filter a bit by the text:

using var listener = new AzureEventSourceListener((eventArgs, text) => AzureEventSourceHandler(eventArgs, text), EventLevel.Informational);

static void AzureEventSourceHandler(EventWrittenEventArgs eventArgs, string text)
{
    if (text.Contains("Credential"))
    {
        Console.WriteLine(text);
    }
}

The important implementation will be to ensure that we can log properly from the AzAuth.Core project and not only AzAuth.PS, but I have a plan for that as well.

PalmEmanuel added a commit that referenced this issue Aug 21, 2024
…identity to noninteractive auth, closes #85, closes #86
@JustinGrote
Copy link
Author

JustinGrote commented Aug 21, 2024

@PalmEmanuel sorry I should have made a note of that since I noticed you were using Azure.Identity, I did the same in a connection handler I made. The eventArgs are actually pretty comprehensive so you can find the appropriate log through that. I marshalled it back to the cmdlet via a blocking collection and did WriteDebug/WriteVerbose from there.

https://github.com/JustinGrote/JAz.LogIngestion/blob/main/Source/Client.PowerShell/Common/AzureDebugLogger.cs
https://github.com/JustinGrote/JAz.LogIngestion/blob/b877613b55391afae0efb0e390ba9f3f8f1e196b/Source/Client.PowerShell/Cmdlets/SendLog.cs#L93

@PalmEmanuel
Copy link
Owner

@JustinGrote Yeah I was thinking of using that approach, thanks for the example! Already using a BlockingCollection in my DeviceCode flow, so it shouldn't be too tricky to get working.

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

No branches or pull requests

2 participants