static async Task MainAsync() { string tenantId = ConfigurationManager.AppSettings["AzureTenantId"]; string clientId = ConfigurationManager.AppSettings["AzureClientId"]; string clientSecret = ConfigurationManager.AppSettings["AzureClientSecret"]; string token = await AuthenticationHelpers.AcquireTokenBySPN(tenantId, clientId, clientSecret); using (var client = new HttpClient(new LoggingHandler(new HttpClientHandler()))) { client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); client.BaseAddress = new Uri("https://management.azure.com/"); await MakeARMRequests(client); } }
static async Task MainAsync() { string tenantId = ConfigurationManager.AppSettings["AzureTenantId"]; string clientId = ConfigurationManager.AppSettings["AzureClientId"]; string clientSecret = ConfigurationManager.AppSettings["AzureClientSecret"]; string token = await AuthenticationHelpers.AcquireTokenBySPN(tenantId, clientId, clientSecret); using (var client = new HttpClient(new LoggingHandler(new HttpClientHandler()))) //using (var client = new HttpClient()) { client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); client.BaseAddress = new Uri("https://management.azure.com/"); //await ListAllResourcesInSubscriptionWithPaging(client); //await DeleteEmptyResourceGroups(client); await TestWebAppOperations(client); await TestFunctionAppOperations(client); } }