Beispiel #1
0
        private static void RunTool(EnvironmentParameters environment)
        {
            var resourceManagerDataProvider = new ResourceManagerDataProvider(environment: environment);

            string authorizationHeader = null;

            if (environment.ProvidedSubscriptionId.IsGuid())
            {
                var tenantId = resourceManagerDataProvider
                               .GetSubscriptionTenantId(subscriptionId: environment.ProvidedSubscriptionId)
                               .Result;

                authorizationHeader = new AuthenticationProvider(environment: environment)
                                      .GetAuthorizationResult(tenantId: tenantId)
                                      .CreateAuthorizationHeader();
            }
            else
            {
                var tenants = resourceManagerDataProvider.GetTenantsWithSubscriptions().Result;
                authorizationHeader = OutputHelpers.PromptForTokenSelection(tenants);
            }

            OutputHelpers.OutputToken(outputMethod: environment.OutputMethod, token: authorizationHeader);
        }