private static void TearDownStorageAccount(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{0}. Delete Storage Account", step);
                ConsoleContinuePrompt("Delete");

                controller.TearDown();
            }
        }
        private static void UpdateStorageAccount(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Update Storage Account named {0}.\n   Updates Description, Label, and GeoReplication status.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Update");

                controller.UpdateStorageAccount("My New Storage Account", "Account Label", StorageAccountTypes.StandardGRS);

                Console.WriteLine("...Complete");
            }
        }
        private static void RegenerateKeys(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Regenerate primary key for Storage Account named {0}.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Regenerate Primary Key");

                controller.RegenerateKeys();

                Console.WriteLine("...Complete");
            }
        }
        private static void SetupStorageAccount(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{2}. Create Storage Account named {0} in Region {1}", managementControllerParameters.StorageAccountName, managementControllerParameters.Region, step);
                ConsoleContinuePrompt("Create");

                controller.CreateStorageAccount();

                Console.WriteLine("...Complete");
            }
        }
        private static void GetStorageAccountConnectionString(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Get connection string for Storage Account named {0}.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Get Connection String");

                string cn = controller.GetStorageAccountConnectionString();
                Console.WriteLine("   Connection String is:\n{0}\n", cn);

                Console.WriteLine("...Complete");
            }
        }
        private static void CheckNameAvailability(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("{1}. Check availability of the requested name: {0}", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Check Availability");

                bool available = controller.CheckNameAvailbility();

                Console.WriteLine("   The requested name {0} {1} available.", managementControllerParameters.StorageAccountName, (available ? "is" : "is not"));

                Console.WriteLine("...Complete");
            }
        }
        private static void ListStorageAccounts(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{0}. List Storage Accounts in subscription.", step);
                ConsoleContinuePrompt("List Storage Accounts");

                StorageAccountListResponse lr = controller.ListStorageAccounts();

                foreach (var r in lr)
                {
                    Console.WriteLine("   Account Name: {0}", r.Name, r.Uri);
                }
                Console.WriteLine("\n   Additional properties are available via .Properties for each account.\n");

                Console.WriteLine("...Complete");
            }
        }
        private static async Task SetupStorageAccountAsync(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{2}. Create Storage Account (async) named {0} in Region {1}", managementControllerParameters.StorageAccountName, managementControllerParameters.Region, step);
                ConsoleContinuePrompt("Create");

                Task t = Task.Run(() => controller.CreateStorageAccountAsync());
                while (t.Status != TaskStatus.RanToCompletion &&
                       t.Status != TaskStatus.Canceled &&
                       t.Status != TaskStatus.Faulted)
                {
                    Console.WriteLine("   Working - status is {0}", t.Status.ToString());
                    Thread.Sleep(5000);
                }

                Console.WriteLine("...Complete");
            }
        }
        private static void GetStorageAccountProperties(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Get properties for Storage Account named {0}.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Get Properties");

                StorageAccountGetResponse gr = controller.GetStorageAccountProperties();

                Console.WriteLine("   Status.................: {0}", gr.StorageAccount.Properties.Status);
                Console.WriteLine("   Label..................: {0}", gr.StorageAccount.Properties.Label);
                Console.WriteLine("   Description............: {0}", gr.StorageAccount.Properties.Description);
                Console.WriteLine("   Affinity Group.........: {0}", gr.StorageAccount.Properties.AffinityGroup);
                Console.WriteLine("   Location...............: {0}", gr.StorageAccount.Properties.Location);
                Console.WriteLine("   Geo-Primary Region.....: {0}", gr.StorageAccount.Properties.GeoPrimaryRegion);
                Console.WriteLine("   Geo-Secondary Region...: {0}", gr.StorageAccount.Properties.GeoSecondaryRegion);
                Console.WriteLine("   Last geo-failover time.: {0}\n", gr.StorageAccount.Properties.LastGeoFailoverTime.ToString());

                Console.WriteLine("...Complete");
            }
        }
示例#10
0
        private static void CheckNameAvailability(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("{1}. Check availability of the requested name: {0}", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Check Availability");

                bool available = controller.CheckNameAvailbility();

                Console.WriteLine("   The requested name {0} {1} available.", managementControllerParameters.StorageAccountName, (available ? "is" : "is not"));

                Console.WriteLine("...Complete");
            }
        }
示例#11
0
        private static async Task SetupStorageAccountAsync(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{2}. Create Storage Account (async) named {0} in Region {1}", managementControllerParameters.StorageAccountName, managementControllerParameters.Region, step);
                ConsoleContinuePrompt("Create");

                Task t = Task.Run(() => controller.CreateStorageAccountAsync());
                while (t.Status != TaskStatus.RanToCompletion &&
                       t.Status != TaskStatus.Canceled &&
                       t.Status != TaskStatus.Faulted)
                {
                    Console.WriteLine("   Working - status is {0}", t.Status.ToString());
                    Thread.Sleep(5000);
                }

                Console.WriteLine("...Complete");
            }
        }
示例#12
0
        private static void UpdateStorageAccount(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Update Storage Account named {0}.\n   Updates Description, Label, and GeoReplication status.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Update");

                controller.UpdateStorageAccount("My New Storage Account", "Account Label", StorageAccountTypes.StandardGRS);

                Console.WriteLine("...Complete");
            }
        }
示例#13
0
        private static void GetStorageAccountConnectionString(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Get connection string for Storage Account named {0}.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Get Connection String");

                string cn = controller.GetStorageAccountConnectionString();
                Console.WriteLine("   Connection String is:\n{0}\n", cn);

                Console.WriteLine("...Complete");
            }
        }
示例#14
0
        private static void RegenerateKeys(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Regenerate primary key for Storage Account named {0}.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Regenerate Primary Key");

                controller.RegenerateKeys();

                Console.WriteLine("...Complete");
            }
        }
示例#15
0
        private static void SetupStorageAccount(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{2}. Create Storage Account named {0} in Region {1}", managementControllerParameters.StorageAccountName, managementControllerParameters.Region, step);
                ConsoleContinuePrompt("Create");

                controller.CreateStorageAccount();

                Console.WriteLine("...Complete");
            }
        }
示例#16
0
        private static void TearDownStorageAccount(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{0}. Delete Storage Account", step);
                ConsoleContinuePrompt("Delete");

                controller.TearDown();
            }
        }
示例#17
0
        private static void ListStorageAccounts(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{0}. List Storage Accounts in subscription.", step);
                ConsoleContinuePrompt("List Storage Accounts");

                StorageAccountListResponse lr = controller.ListStorageAccounts();

                foreach (var r in lr)
                {
                    Console.WriteLine("   Account Name: {0}", r.Name, r.Uri);
                }
                Console.WriteLine("\n   Additional properties are available via .Properties for each account.\n");

                Console.WriteLine("...Complete");
            }
        }
示例#18
0
        private static void GetStorageAccountProperties(ManagementControllerParameters managementControllerParameters, int step)
        {
            using (var controller = new ManagementController(managementControllerParameters))
            {
                Console.WriteLine("\n{1}. Get properties for Storage Account named {0}.", managementControllerParameters.StorageAccountName, step);
                ConsoleContinuePrompt("Get Properties");

                StorageAccountGetResponse gr = controller.GetStorageAccountProperties();

                Console.WriteLine("   Status.................: {0}", gr.StorageAccount.Properties.Status);
                Console.WriteLine("   Label..................: {0}", gr.StorageAccount.Properties.Label);
                Console.WriteLine("   Description............: {0}", gr.StorageAccount.Properties.Description);
                Console.WriteLine("   Affinity Group.........: {0}", gr.StorageAccount.Properties.AffinityGroup);
                Console.WriteLine("   Location...............: {0}", gr.StorageAccount.Properties.Location);
                Console.WriteLine("   Geo-Primary Region.....: {0}", gr.StorageAccount.Properties.GeoPrimaryRegion);
                Console.WriteLine("   Geo-Secondary Region...: {0}", gr.StorageAccount.Properties.GeoSecondaryRegion);
                Console.WriteLine("   Last geo-failover time.: {0}\n", gr.StorageAccount.Properties.LastGeoFailoverTime.ToString());

                Console.WriteLine("...Complete");
            }
        }