private async Task OnCmdletBeginProcessing(string id, CancellationToken cancellationToken, Func <EventArgs> getEventData, Func <string, CancellationToken, Func <EventArgs>, Task> signal, InvocationInfo invocationInfo) { using (Extensions.NoSynchronizationContext) { string[] commandNameSegment = invocationInfo.MyCommand.Name.Split('_'); if (commandNameSegment.Length > 1) { await signal(Events.Debug, cancellationToken, () => EventFactory.CreateLogEvent($"[{id}]: - {commandNameSegment[0]} begin processing with parameterSet '{commandNameSegment[1]}'.")); } else { await signal(Events.Debug, cancellationToken, () => EventFactory.CreateLogEvent($"[{id}]: - {invocationInfo.MyCommand.Name} begin processing.")); } IAuthContext authContext = Microsoft.Graph.PowerShell.Authentication.GraphSession.Instance.AuthContext; if (authContext != null) { await signal(Events.Debug, cancellationToken, () => EventFactory.CreateLogEvent($"[Authentication]: - AuthType: '{authContext.AuthType}', AuthProviderType: '{authContext.AuthProviderType}', ContextScope: '{authContext.ContextScope}', AppName: '{authContext.AppName}'.")); var scopes = authContext.Scopes == null ? string.Empty : string.Join(", ", authContext.Scopes); await signal(Events.Debug, cancellationToken, () => EventFactory.CreateLogEvent($"[Authentication]: - Scopes: [{scopes}].")); } } }