Exemplo n.º 1
0
        public MigrationService()
        {
            var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

            XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));

            adB2CUsersAll = new List <User>();
            config        = AppSettingsFile.ReadFromJsonFile();

            var subscriptions  = config.APIMSubscriptionIds == null ? new String[] { } : config.APIMSubscriptionIds.Split(";");
            var serviceNames   = config.APIMApiManagementNames == null ? new String[] { } : config.APIMApiManagementNames.Split(";");
            var resourceGroups = config.APIMResourceGroups == null ? new String[] { } : config.APIMResourceGroups.Split(";");


            if (subscriptions.Length > 0 && subscriptions.Length.Equals(serviceNames.Length) && subscriptions.Length.Equals(resourceGroups.Length))
            {
                apims = new APIMService[serviceNames.Length];
                apimUserCollections = new UserCollection[serviceNames.Length];


                for (int i = 0; i < serviceNames.Length; i++)
                {
                    apims[i] = new APIMService(serviceNames[i], resourceGroups[i], config.APIMTenantId, subscriptions[i]);
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error on Configuration:");
                Console.WriteLine(" API Mgmt Services      : " + serviceNames.Length);
                Console.WriteLine(" API Mgmt RGs           : " + resourceGroups.Length);
                Console.WriteLine(" API Mgmt Subscrpitions : " + subscriptions.Length);
                Console.ForegroundColor = ConsoleColor.White;
            }
        }