/// <summary> /// Display in the console the result of searching in the Azure AD Gallery /// </summary> /// <param name="applicationTemplates"></param> private static void DisplayGalleryResults(Beta.IGraphServiceApplicationTemplatesCollectionPage applicationTemplates) { var count = 0; Logger.Info("id | appId | appName "); foreach (var applicationTemplate in applicationTemplates) { Logger.Info(count + " - " + applicationTemplate.Id + " - " + applicationTemplate.DisplayName); count++; } }
private static async Task <NewGalleryAppDetails> NewGalleryAppDetails(GalleryAppsRepository galleryAppsRepository) { Logger.Info("Enter the name of the application you want to create:"); var appName = Console.ReadLine(); // Using the appName provided, search for applications in the Gallery that matches the appName Beta.IGraphServiceApplicationTemplatesCollectionPage appTemplatesResponse = await galleryAppsRepository.GetByNameAsync(appName); DisplayGalleryResults(appTemplatesResponse); Logger.Info("Select the application you want to create:"); var selectedAppTemplateId = Convert.ToInt32(Console.ReadLine()); // Create application template with appTemplateID and appDisplayName var newGalleryAppDetailsBuilder = new NewGalleryAppDetails.Builder(appTemplatesResponse[selectedAppTemplateId].Id); newGalleryAppDetailsBuilder.DisplayName(appTemplatesResponse[selectedAppTemplateId].DisplayName + " Automated"); newGalleryAppDetailsBuilder.PreferredSsoMode(PreferredSso.SAML); const string defaultLoginUrl = "https://example.com"; Logger.Info($"Please enter the loginUrl (or press enter to use '{defaultLoginUrl}')"); newGalleryAppDetailsBuilder.LoginUrl(ReadAnswerOrUseDefault(defaultLoginUrl)); const string defaultReplyUrl = "https://example.com/replyurl"; Logger.Info($"Please enter the replyUrl (or press enter to use '{defaultReplyUrl}')"); newGalleryAppDetailsBuilder.ReplyUrl(ReadAnswerOrUseDefault(defaultReplyUrl)); const string defaultIdentifierUri = "https://example.com/identifier2"; Logger.Info($"Please enter the identifierUri (or press enter to use '{defaultIdentifierUri}')"); newGalleryAppDetailsBuilder.IdentifierUri(ReadAnswerOrUseDefault(defaultIdentifierUri)); Logger.Info("This tool will read the claims mapping policy from this location ./Files/claimsMappingPolicy.json"); newGalleryAppDetailsBuilder.ClaimsMappingPolicyPath("./Files/claimsMappingPolicy.json"); return(newGalleryAppDetailsBuilder.Build()); }