Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }