public async Task Aquire(IAzureOptionsCommon options, IInputService _input) { var defaultEnvironment = (await Environment.GetValue()) ?? AzureEnvironments.AzureCloud; var environments = new List <Choice <Func <Task> > >( AzureEnvironments.ResourceManagerUrls .OrderBy(kvp => kvp.Key) .Select(kvp => Choice.Create <Func <Task> >(() => { options.AzureEnvironment = kvp.Key; return(Task.CompletedTask); }, description: kvp.Key, @default: kvp.Key == defaultEnvironment))) { Choice.Create <Func <Task> >(async() => await InputUrl(_input, options), "Use a custom resource manager url") }; var chosen = await _input.ChooseFromMenu("Which Azure environment are you using?", environments); await chosen.Invoke(); options.UseMsi = await UseMsi.GetValue() == true || await _input.PromptYesNo("Do you want to use a managed service identity?", false); if (!options.UseMsi) { // These options are only necessary for client id/secret authentication. options.TenantId = await TenantId.Interactive(_input, "Directory/tenant id").GetValue(); options.ClientId = await ClientId.Interactive(_input, "Application client id").GetValue(); options.Secret = await ClientSecret.Interactive(_input, "Application client secret").GetValue(); } }