Exemple #1
0
 partial void BeforeCreatePipeline(System.Management.Automation.InvocationInfo invocationInfo, ref Runtime.HttpPipeline pipeline)
 {
     // Call Init to trigger any custom initialization needed after
     // module load and before pipeline is setup and used.
     Init();
     pipeline = new Runtime.HttpPipeline(new Runtime.HttpClientFactory(HttpHelpers.GetGraphHttpClient()));
 }
        partial void BeforeCreatePipeline(System.Management.Automation.InvocationInfo invocationInfo, ref Runtime.HttpPipeline pipeline)
        {
            using (var powershell = PowerShell.Create(RunspaceMode.CurrentRunspace))
            {
                powershell.Commands.AddCommand(new Command($"$executioncontext.SessionState.PSVariable.GetValue('{Constants.GraphAuthConfigId}')", true));

                AuthConfig authConfig = powershell.Invoke <AuthConfig>().FirstOrDefault();

                if (authConfig == null)
                {
                    throw new Exception("Authentication needed, call Connect-Graph.");
                }

                pipeline = new Runtime.HttpPipeline(new Runtime.HttpClientFactory(HttpHelpers.GetGraphHttpClient(authConfig)));
            }
        }
Exemple #3
0
 partial void BeforeCreatePipeline(System.Management.Automation.InvocationInfo invocationInfo, ref Runtime.HttpPipeline pipeline)
 {
     pipeline = new Runtime.HttpPipeline(new Runtime.HttpClientFactory(HttpHelpers.GetGraphHttpClient()));
 }