private static IAzure BuildServicePrincipalConnection(ServicePrincipalConfiguration servicePrincipal)
        {
            var credentials = SdkContext
                              .AzureCredentialsFactory
                              .FromServicePrincipal(servicePrincipal.ClientId, servicePrincipal.ClientSecret, servicePrincipal.TenantId, AzureEnvironment.AzureGlobalCloud);

            return(Azure
                   .Configure()
                   .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
                   .Authenticate(credentials)
                   .WithDefaultSubscription());
        }
        private static ServiceProvider BuildDependencyInjection()
        {
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)
                                    .AddJsonFile("appsettings.Development.json", optional: true)
                                    .Build();

            return(new ServiceCollection()
                   .AddLogging(loggingBuilder =>
            {
                loggingBuilder.AddConfiguration(config.GetSection("Logging"));
                loggingBuilder.AddConsole();
            })
                   .AddTransient((provider) =>
            {
                var servicePrincipalConfigSection = config.GetSection("ServicePrincipalConfiguration");
                var servicePrincipalConfiguration = new ServicePrincipalConfiguration(
                    servicePrincipalConfigSection["TenantId"],
                    servicePrincipalConfigSection["ClientId"],
                    servicePrincipalConfigSection["ClientSecret"]
                    );

                return BuildServicePrincipalConnection(servicePrincipalConfiguration);
            })
                   .AddTransient(prodvider =>
            {
                return config.GetSection("SlackClientSettings").Get <SlackClientSettings>();
            })
                   .AddTransient <ResourceGroupWrapper>()
                   .AddHttpClient <ISlackClient, SlackClient>((provider, client) =>
            {
                var slackClientSettings = provider.GetService <SlackClientSettings>();
                if (slackClientSettings == null || string.IsNullOrWhiteSpace(slackClientSettings.BearerToken))
                {
                    throw new ArgumentException("SlackClientSettings must be defined for Slack communication.");
                }

                client.BaseAddress = new Uri("https://slack.com/api/");
                client.DefaultRequestHeaders.Add("Authorization", $"Bearer {slackClientSettings.BearerToken}");
            })
                   .Services
                   .BuildServiceProvider());
        }