예제 #1
0
 static void Main(string[] args)
 {
     CloudStackConsoleInstaller installer = new CloudStackConsoleInstaller();
     Console.Write("---------- CloudStack Installer ----------\n");
     Console.Write("Hi there! \nFirst, this installer will download the latest CloudStack binaries." + 
         " \nThen, it will configure a new website for CloudStack on this IIS server. \nFinally, it will register the" + 
         " instance of CloudStack with your Azure Active Directory so that it can manage your Azure cloud.\n\n");
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.Write("Sounds good? If so, hit enter. If not, close this widow.");
     Console.ResetColor();
     Console.ReadLine();
     Console.Write("\n1) Downloading CloudStack binaries ... ");
     installer.DummyMethodDownloadCloudStackBinaries();
     Console.Write("Done. \n\n2) Installing CloudStack website on this web server ... ");
     installer.DummyMethodInstallCloudStackWebsite();
     Console.Write("Done. \n\n3) Alright, let's connect this CloudStack instance with your Azure Cloud - ");
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.Write("please enter the id of your Azure subscription that you wish to connect: ");
     Console.ResetColor();
     string subscriptionId = Console.ReadLine();
     string aadId = installer.GetAADForSubscription(subscriptionId);
     DeviceAuthCodeResponse codeResponse = installer.GetDeviceAuthCode(aadId);
     Console.Write("Got it. \nNow, you must authenticate with the account that you use to manage your Azure cloud - ");
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.Write("use a web browser to open the page {0} and enter the code {1}.", codeResponse.VerificationUrl, codeResponse.UserCode);
     Console.ResetColor();
     Console.Write("\nPatiently waiting ... ");
     DeviceAuthTokenResponse tokenResponse = installer.GetDeviceAuthToken(codeResponse, aadId);
     AADUser user = installer.GetAzureADUser(tokenResponse.AccessToken);
     Console.Write("Ah! welcome {0}! Registering CloudStack in your Azure Active Directory now ... ", user.DisplayName);
     installer.RegisterAzureADApplication(tokenResponse.AccessToken, "http://localhost");
     Console.Write(" All done.");
 }
예제 #2
0
        static void Main(string[] args)
        {
            CloudStackConsoleInstaller installer = new CloudStackConsoleInstaller();

            Console.Write("---------- CloudStack Installer ----------\n");
            Console.Write("Hi there! \nFirst, this installer will download the latest CloudStack binaries." +
                          " \nThen, it will configure a new website for CloudStack on this IIS server. \nFinally, it will register the" +
                          " instance of CloudStack with your Azure Active Directory so that it can manage your Azure cloud.\n\n");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.Write("Sounds good? If so, hit enter. If not, close this widow.");
            Console.ResetColor();
            Console.ReadLine();
            Console.Write("\n1) Downloading CloudStack binaries ... ");
            installer.DummyMethodDownloadCloudStackBinaries();
            Console.Write("Done. \n\n2) Installing CloudStack website on this web server ... ");
            installer.DummyMethodInstallCloudStackWebsite();
            Console.Write("Done. \n\n3) Alright, let's connect this CloudStack instance with your Azure Cloud - ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.Write("please enter the id of your Azure subscription that you wish to connect: ");
            Console.ResetColor();
            string subscriptionId = Console.ReadLine();
            string aadId          = installer.GetAADForSubscription(subscriptionId);
            DeviceAuthCodeResponse codeResponse = installer.GetDeviceAuthCode(aadId);

            Console.Write("Got it. \nNow, you must authenticate with the account that you use to manage your Azure cloud - ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.Write("use a web browser to open the page {0} and enter the code {1}.", codeResponse.VerificationUrl, codeResponse.UserCode);
            Console.ResetColor();
            Console.Write("\nPatiently waiting ... ");
            DeviceAuthTokenResponse tokenResponse = installer.GetDeviceAuthToken(codeResponse, aadId);
            AADUser user = installer.GetAzureADUser(tokenResponse.AccessToken);

            Console.Write("Ah! welcome {0}! Registering CloudStack in your Azure Active Directory now ... ", user.DisplayName);
            installer.RegisterAzureADApplication(tokenResponse.AccessToken, "http://localhost");
            Console.Write(" All done.");
        }