コード例 #1
0
        public void RestartAzureVM(string vmName, string serviceName)
        {
            RestartAzureVMCmdletInfo     restartAzureVMCmdlet  = new RestartAzureVMCmdletInfo(vmName, serviceName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(restartAzureVMCmdlet);

            azurePowershellCmdlet.Run();
        }
コード例 #2
0
        internal void NewAzureService(string serviceName, string serviceLabel, string locationName)
        {
            NewAzureServiceCmdletInfo    newAzureServiceCmdletInfo = new NewAzureServiceCmdletInfo(serviceName, serviceLabel, locationName);
            WindowsAzurePowershellCmdlet newAzureServiceCmdlet     = new WindowsAzurePowershellCmdlet(newAzureServiceCmdletInfo);

            Collection <PSObject> result = newAzureServiceCmdlet.Run();
        }
コード例 #3
0
        public void StopAzureVM(string vmName, string serviceName)
        {
            StopAzureVMCmdletInfo        stopAzureVMCmdlet     = new StopAzureVMCmdletInfo(vmName, serviceName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(stopAzureVMCmdlet);

            azurePowershellCmdlet.Run();
        }
コード例 #4
0
        public PersistentVMRoleContext NewAzureQuickVM(OS os, string name, string serviceName, string imageName, string userName, string password, string locationName, InstanceSize?instanceSize)
        {
            NewAzureQuickVMCmdletInfo    newAzureQuickVMCmdlet = new NewAzureQuickVMCmdletInfo(os, name, serviceName, imageName, userName, password, locationName, instanceSize);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureQuickVMCmdlet);

            SubscriptionData currentSubscription;

            if ((currentSubscription = GetCurrentAzureSubscription()) == null)
            {
                ImportAzurePublishSettingsFile();
                currentSubscription = GetCurrentAzureSubscription();
            }
            if (string.IsNullOrEmpty(currentSubscription.CurrentStorageAccount))
            {
                StorageServicePropertiesOperationContext storageAccount = NewAzureStorageAccount(Utilities.GetUniqueShortName("storage"), locationName);
                if (storageAccount != null)
                {
                    SetAzureSubscription(currentSubscription.SubscriptionName, storageAccount.StorageAccountName);
                    currentSubscription = GetCurrentAzureSubscription();
                }
            }
            if (!string.IsNullOrEmpty(currentSubscription.CurrentStorageAccount))
            {
                azurePowershellCmdlet.Run();
                return(GetAzureVM(name, serviceName));
            }
            return(null);
        }
コード例 #5
0
        public string SaveAzureVhdStop(Uri source, FileInfo localFilePath, int?numThreads, string storageKey, bool overwrite, int ms)
        {
            SaveAzureVhdCmdletInfo       saveAzureVhdCmdletInfo = new SaveAzureVhdCmdletInfo(source, localFilePath, numThreads, storageKey, overwrite);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet  = new WindowsAzurePowershellCmdlet(saveAzureVhdCmdletInfo);

            return(azurePowershellCmdlet.RunAndStop(ms).ToString());
        }
コード例 #6
0
        public void RemoveAzureService(string serviceName)
        {
            RemoveAzureServiceCmdletInfo removeAzureServiceCmdletInfo = new RemoveAzureServiceCmdletInfo(serviceName);
            WindowsAzurePowershellCmdlet removeAzureServiceCmdlet     = new WindowsAzurePowershellCmdlet(removeAzureServiceCmdletInfo);

            var result = removeAzureServiceCmdlet.Run();
        }
コード例 #7
0
        public void RemoveAzureSubscription(string subscriptionName, bool force)
        {
            RemoveAzureSubscriptionCmdletInfo removeAzureSubscriptionCmdletInfo = new RemoveAzureSubscriptionCmdletInfo(subscriptionName, null, force);
            WindowsAzurePowershellCmdlet      removeAzureSubscriptionCmdlet     = new WindowsAzurePowershellCmdlet(removeAzureSubscriptionCmdletInfo);

            var result = removeAzureSubscriptionCmdlet.Run();
        }
コード例 #8
0
        internal void ImportAzurePublishSettingsFile(string publishSettingsFile)
        {
            ImportAzurePublishSettingsFileCmdletInfo importAzurePublishSettingsFileCmdlet = new ImportAzurePublishSettingsFileCmdletInfo(publishSettingsFile);

            WindowsAzurePowershellCmdlet importAzurePublishSettingsFile = new WindowsAzurePowershellCmdlet(importAzurePublishSettingsFileCmdlet);
            var i = importAzurePublishSettingsFile.Run();

            Console.WriteLine(i.ToString());
        }
コード例 #9
0
        /// <summary>
        /// Run a powershell cmdlet that returns the first PSObject as a return value.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="cmdlet"></param>
        /// <returns></returns>
        private T RunPSCmdletAndReturnFirst <T>(PowershellCore.CmdletsInfo cmdlet)
        {
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(cmdlet);
            Collection <PSObject>        result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return((T)result[0].BaseObject);
            }
            return(default(T));
        }
コード例 #10
0
        public StorageServiceKeyOperationContext NewAzureStorageAccountKey(string stroageAccountName, string keyType)
        {
            NewAzureStorageKeyCmdletInfo newAzureStorageKeyCmdletInfo = new NewAzureStorageKeyCmdletInfo(stroageAccountName, keyType);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet        = new WindowsAzurePowershellCmdlet(newAzureStorageKeyCmdletInfo);
            Collection <PSObject>        result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return((StorageServiceKeyOperationContext)result[0].BaseObject);
            }
            return(null);
        }
コード例 #11
0
        /// <summary>
        /// Run a powershell cmdlet that returns a collection of PSObjects as a return value.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="cmdlet"></param>
        /// <returns></returns>
        private Collection <T> RunPSCmdletAndReturnAll <T>(PowershellCore.CmdletsInfo cmdlet)
        {
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(cmdlet);
            Collection <PSObject>        result = azurePowershellCmdlet.Run();
            Collection <T> resultCollection     = new Collection <T>();

            foreach (PSObject re in result)
            {
                resultCollection.Add((T)re.BaseObject);
            }
            return(resultCollection);
        }
コード例 #12
0
        public PersistentVM AddAzureDataDisk(AddAzureDataDiskConfig diskConfig)
        {
            AddAzureDataDiskCmdletInfo addAzureDataDiskCmdletInfo = new AddAzureDataDiskCmdletInfo(diskConfig);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(addAzureDataDiskCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (PersistentVM)result[0].BaseObject;
            }
            return null;
        }
コード例 #13
0
        public ManagementOperationContext AddAzureCertificate(string serviceName, PSObject cert, string password)
        {
            AddAzureCertificateCmdletInfo addAzureCertificateCmdletInfo = new AddAzureCertificateCmdletInfo(serviceName, cert, password);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(addAzureCertificateCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #14
0
        // Add-AzureDisk
        public DiskContext AddAzureDisk(string diskName, string mediaPath, string label, string os)
        {
            AddAzureDiskCmdletInfo addAzureDiskCmdletInfo = new AddAzureDiskCmdletInfo(diskName, mediaPath, label, os);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(addAzureDiskCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (DiskContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #15
0
        public DnsServerList GetAzureDns(DnsSettings settings)
        {
            GetAzureDnsCmdletInfo        getAzureDnsCmdletInfo = new GetAzureDnsCmdletInfo(settings);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(getAzureDnsCmdletInfo);

            Collection <PSObject> result  = azurePowershellCmdlet.Run();
            DnsServerList         dnsList = new DnsServerList();

            foreach (PSObject re in result)
            {
                dnsList.Add((DnsServer)re.BaseObject);
            }
            return(dnsList);
        }
コード例 #16
0
        public SubnetNamesCollection GetAzureSubnet(PersistentVM vm)
        {
            GetAzureSubnetCmdletInfo     getAzureSubnetCmdlet  = new GetAzureSubnetCmdletInfo(vm);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(getAzureSubnetCmdlet);
            Collection <PSObject>        result = azurePowershellCmdlet.Run();

            SubnetNamesCollection subnets = new SubnetNamesCollection();

            foreach (PSObject re in result)
            {
                subnets.Add((string)re.BaseObject);
            }
            return(subnets);
        }
コード例 #17
0
        public SubscriptionData SetDefaultAzureSubscription(string subscriptionName)
        {
            SetAzureSubscriptionCmdletInfo setAzureSubscriptionCmdlet = new SetAzureSubscriptionCmdletInfo(subscriptionName);
            WindowsAzurePowershellCmdlet   azurePowershellCmdlet      = new WindowsAzurePowershellCmdlet(setAzureSubscriptionCmdlet);

            azurePowershellCmdlet.Run();

            Collection <SubscriptionData> subscriptions = GetAzureSubscription();

            foreach (SubscriptionData subscription in subscriptions)
            {
                if (subscription.SubscriptionName == subscriptionName)
                {
                    return(subscription);
                }
            }
            return(null);
        }
コード例 #18
0
 public StorageServiceKeyOperationContext NewAzureStorageAccountKey(string stroageAccountName, string keyType)
 {
     NewAzureStorageKeyCmdletInfo newAzureStorageKeyCmdletInfo = new NewAzureStorageKeyCmdletInfo(stroageAccountName, keyType);
     WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureStorageKeyCmdletInfo);
     Collection<PSObject> result = azurePowershellCmdlet.Run();
     if (result.Count == 1)
     {
         return (StorageServiceKeyOperationContext)result[0].BaseObject;
     }
     return null;
 }
コード例 #19
0
        public ManagementOperationContext NewAzureStorageAccount(string storageName, string locationName, string affinity, string label, string description)
        {
            NewAzureStorageAccountCmdletInfo newAzureStorageAccountCmdletInfo = new NewAzureStorageAccountCmdletInfo(storageName, locationName, affinity, label, description);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureStorageAccountCmdletInfo);
            Collection<PSObject> result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #20
0
        public ManagementOperationContext RemoveAzureVNetConfig()
        {
            RemoveAzureVNetConfigCmdletInfo removeAzureVNetConfigCmdletInfo = new RemoveAzureVNetConfigCmdletInfo();
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureVNetConfigCmdletInfo);
            Collection<PSObject> result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #21
0
 public void RemoveAzureStorageAccount(string storageAccountName)
 {
     var removeAzureStorageAccountCmdletInfo = new RemoveAzureStorageAccountCmdletInfo(storageAccountName);
     var azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureStorageAccountCmdletInfo);
     Collection<PSObject> result = azurePowershellCmdlet.Run();
 }
コード例 #22
0
        public string AddAzureVhdStop(FileInfo localFile, string destination, int ms)
        {
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(new AddAzureVhdCmdletInfo(destination, localFile.FullName, null, false, null));

            return(azurePowershellCmdlet.RunAndStop(ms).ToString());
        }
コード例 #23
0
        public ManagementOperationContext RemoveAzureAffinityGroup(string name)
        {
            RemoveAzureAffinityGroupCmdletInfo removeAzureAffinityGroupCmdletInfo = new RemoveAzureAffinityGroupCmdletInfo(name);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureAffinityGroupCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #24
0
 public string SaveAzureVhdStop(Uri source, FileInfo localFilePath, int? numThreads, string storageKey, bool overwrite, int ms)
 {
     SaveAzureVhdCmdletInfo saveAzureVhdCmdletInfo = new SaveAzureVhdCmdletInfo(source, localFilePath, numThreads, storageKey, overwrite);
     WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(saveAzureVhdCmdletInfo);
     return azurePowershellCmdlet.RunAndStop(ms).ToString();
 }
コード例 #25
0
 public void RestartAzureVM(string vmName, string serviceName)
 {
     RestartAzureVMCmdletInfo restartAzureVMCmdlet = new RestartAzureVMCmdletInfo(vmName, serviceName);
     WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(restartAzureVMCmdlet);
     azurePowershellCmdlet.Run();
 }
コード例 #26
0
        public Collection<VirtualNetworkSiteContext> GetAzureVNetSite(string vnetName)
        {
            GetAzureVNetSiteCmdletInfo getAzureVNetSiteCmdletInfo = new GetAzureVNetSiteCmdletInfo(vnetName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(getAzureVNetSiteCmdletInfo);
            Collection<PSObject> result = azurePowershellCmdlet.Run();

            Collection<VirtualNetworkSiteContext> connections = new Collection<VirtualNetworkSiteContext>();
            foreach (PSObject re in result)
            {
                connections.Add((VirtualNetworkSiteContext)re.BaseObject);
            }
            return connections;
        }
コード例 #27
0
        public SharedKeyContext GetAzureVNetGatewayKey(string vnetName, string localnet)
        {
            GetAzureVNetGatewayKeyCmdletInfo getAzureVNetGatewayKeyCmdletInfo = new GetAzureVNetGatewayKeyCmdletInfo(vnetName, localnet);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(getAzureVNetGatewayKeyCmdletInfo);
            Collection<PSObject> result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return (SharedKeyContext) result[0].BaseObject;
            }
            return null;
        }
コード例 #28
0
        public Collection<VirtualNetworkGatewayContext> GetAzureVNetGateway(string vnetName)
        {
            GetAzureVNetGatewayCmdletInfo getAzureVNetGatewayCmdletInfo = new GetAzureVNetGatewayCmdletInfo(vnetName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(getAzureVNetGatewayCmdletInfo);
            Collection<PSObject> result = azurePowershellCmdlet.Run();

            Collection<VirtualNetworkGatewayContext> vnetGateways = new Collection<VirtualNetworkGatewayContext>();
            foreach (PSObject re in result)
            {
                vnetGateways.Add ((VirtualNetworkGatewayContext) re.BaseObject);
            }
            return vnetGateways;
        }
コード例 #29
0
        public PersistentVMRoleContext GetAzureVM(string vmName, string serviceName)
        {
            GetAzureVMCmdletInfo getAzureVMCmdletInfo = new GetAzureVMCmdletInfo(vmName, serviceName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(getAzureVMCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (PersistentVMRoleContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #30
0
        public PersistentVM NewAzureVMConfig(AzureVMConfigInfo vmConfig)
        {
            NewAzureVMConfigCmdletInfo newAzureVMConfigCmdletInfo = new NewAzureVMConfigCmdletInfo(vmConfig);
            WindowsAzurePowershellCmdlet newAzureServiceCmdlet = new WindowsAzurePowershellCmdlet(newAzureVMConfigCmdletInfo);

            Collection<PSObject> result = newAzureServiceCmdlet.Run();
            if (result.Count == 1)
            {
                return (PersistentVM)result[0].BaseObject;
            }
            return null;
        }
コード例 #31
0
        public ManagementOperationContext NewAzureVNetGateway(string vnetName)
        {
            NewAzureVNetGatewayCmdletInfo newAzureVNetGatewayCmdletInfo = new NewAzureVNetGatewayCmdletInfo(vnetName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureVNetGatewayCmdletInfo);
            Collection<PSObject> result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #32
0
        public ManagementOperationContext RemoveAzureDeployment(string serviceName, string slot, bool force)
        {
            RemoveAzureDeploymentCmdletInfo removeAzureDeploymentCmdletInfo = new RemoveAzureDeploymentCmdletInfo(serviceName, slot, force);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureDeploymentCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #33
0
        public ManagementOperationContext RemoveAzureCertificate(string serviceName, string thumbprint, string algorithm)
        {
            RemoveAzureCertificateCmdletInfo removeAzureCertificateCmdletInfo = new RemoveAzureCertificateCmdletInfo(serviceName, thumbprint, algorithm);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureCertificateCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #34
0
        public PersistentVMRoleContext RemoveAzureEndPoint(string epName, PersistentVMRoleContext vmRoleCtxt)
        {
            RemoveAzureEndpointCmdletInfo removeAzureEndPointCmdletInfo = new RemoveAzureEndpointCmdletInfo(epName, vmRoleCtxt);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureEndPointCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (PersistentVMRoleContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #35
0
        // Remove-AzureDisk
        public ManagementOperationContext RemoveAzureDisk(string diskName, bool deleteVhd)
        {
            RemoveAzureDiskCmdletInfo removeAzureDiskCmdletInfo = new RemoveAzureDiskCmdletInfo(diskName, deleteVhd);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureDiskCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #36
0
        public ManagementOperationContext NewAzureDeployment(string serviceName, string packagePath, string configPath, string slot, string label, string name, bool doNotStart, bool warning)
        {
            NewAzureDeploymentCmdletInfo newAzureDeploymentCmdletInfo = new NewAzureDeploymentCmdletInfo(serviceName, packagePath, configPath, slot, label, name, doNotStart, warning);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureDeploymentCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #37
0
        public void RemoveAzureService(string serviceName)
        {
            RemoveAzureServiceCmdletInfo removeAzureServiceCmdletInfo = new RemoveAzureServiceCmdletInfo(serviceName);
            WindowsAzurePowershellCmdlet removeAzureServiceCmdlet = new WindowsAzurePowershellCmdlet(removeAzureServiceCmdletInfo);

            var result = removeAzureServiceCmdlet.Run();
        }
コード例 #38
0
        public DnsServer NewAzureDns(string name, string ipAddress)
        {
            NewAzureDnsCmdletInfo newAzureDnsCmdletInfo = new NewAzureDnsCmdletInfo(name, ipAddress);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureDnsCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (DnsServer)result[0].BaseObject;
            }
            return null;
        }
コード例 #39
0
        public void RemoveAzureVM(string vmName, string serviceName)
        {
            RemoveAzureVMCmdletInfo removeAzureVMCmdletInfo = new RemoveAzureVMCmdletInfo(vmName, serviceName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureVMCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
        }
コード例 #40
0
        public ManagementOperationContext NewAzureService(string serviceName, string location)
        {
            var newAzureServiceCmdletInfo = new NewAzureServiceCmdletInfo(serviceName, location);
            var newAzureServiceCmdlet = new WindowsAzurePowershellCmdlet(newAzureServiceCmdletInfo);

            var result = newAzureServiceCmdlet.Run();

            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #41
0
        public ManagementOperationContext RemoveAzureVNetGateway(string vnetName)
        {
            GetAzureVNetGatewayKeyCmdletInfo a = new GetAzureVNetGatewayKeyCmdletInfo("aaa", "vvv");

            RemoveAzureVNetGatewayCmdletInfo removeAzureVNetGatewayCmdletInfo = new RemoveAzureVNetGatewayCmdletInfo(vnetName);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureVNetGatewayCmdletInfo);
            Collection<PSObject> result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #42
0
 public void RemoveAzureStorageAccount(string storageAccountName)
 {
     var removeAzureStorageAccountCmdletInfo = new RemoveAzureStorageAccountCmdletInfo(storageAccountName);
     var azurePowershellCmdlet    = new WindowsAzurePowershellCmdlet(removeAzureStorageAccountCmdletInfo);
     Collection <PSObject> result = azurePowershellCmdlet.Run();
 }
コード例 #43
0
        public PersistentVM AddAzureEndPointNoLB(AzureEndPointConfigInfo endPointConfig)
        {
            AddAzureEndpointCmdletInfo addAzureEndPointCmdletInfo = AddAzureEndpointCmdletInfo.BuildNoLoadBalancedCmdletInfo(endPointConfig);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(addAzureEndPointCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (PersistentVM)result[0].BaseObject;
            }
            return null;
        }
コード例 #44
0
        public Collection<PersistentVM> ImportAzureVM(string path)
        {
            Collection<PersistentVM> result = new Collection<PersistentVM>();
            ImportAzureVMCmdletInfo importAzureVMCmdletInfo = new ImportAzureVMCmdletInfo(path);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(importAzureVMCmdletInfo);

            foreach (var vm in azurePowershellCmdlet.Run())
            {
                result.Add((PersistentVM)vm.BaseObject);
            }
            return result;
        }
コード例 #45
0
        public ManagementOperationContext SetAzureAffinityGroup(string name, string label, string description)
        {
            SetAzureAffinityGroupCmdletInfo setAzureAffinityGroupCmdletInfo = new SetAzureAffinityGroupCmdletInfo(name, label, description);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(setAzureAffinityGroupCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();
            if (result.Count == 1)
            {
                return (ManagementOperationContext)result[0].BaseObject;
            }
            return null;
        }
コード例 #46
0
        public CertificateSetting NewAzureCertificateSetting(string thumbprint, string store)
        {
            NewAzureCertificateSettingCmdletInfo newAzureCertificateSettingCmdletInfo = new NewAzureCertificateSettingCmdletInfo(thumbprint, store);
            WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureCertificateSettingCmdletInfo);

            Collection<PSObject> result = azurePowershellCmdlet.Run();

            if (result.Count == 1)
            {
                return (CertificateSetting)result[0].BaseObject;

            }
            return null;
        }