public void StopAzureVM(string vmName, string serviceName) { StopAzureVMCmdletInfo stopAzureVMCmdlet = new StopAzureVMCmdletInfo(vmName, serviceName); WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(stopAzureVMCmdlet); azurePowershellCmdlet.Run(); }
public void RemoveAzureService(string serviceName) { RemoveAzureServiceCmdletInfo removeAzureServiceCmdletInfo = new RemoveAzureServiceCmdletInfo(serviceName); WindowsAzurePowershellCmdlet removeAzureServiceCmdlet = new WindowsAzurePowershellCmdlet(removeAzureServiceCmdletInfo); var result = removeAzureServiceCmdlet.Run(); }
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); }
public void RestartAzureVM(string vmName, string serviceName) { RestartAzureVMCmdletInfo restartAzureVMCmdlet = new RestartAzureVMCmdletInfo(vmName, serviceName); WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(restartAzureVMCmdlet); azurePowershellCmdlet.Run(); }
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(); }
public void RemoveAzureSubscription(string subscriptionName, bool force) { RemoveAzureSubscriptionCmdletInfo removeAzureSubscriptionCmdletInfo = new RemoveAzureSubscriptionCmdletInfo(subscriptionName, null, force); WindowsAzurePowershellCmdlet removeAzureSubscriptionCmdlet = new WindowsAzurePowershellCmdlet(removeAzureSubscriptionCmdletInfo); var result = removeAzureSubscriptionCmdlet.Run(); }
internal void ImportAzurePublishSettingsFile(string publishSettingsFile) { ImportAzurePublishSettingsFileCmdletInfo importAzurePublishSettingsFileCmdlet = new ImportAzurePublishSettingsFileCmdletInfo(publishSettingsFile); WindowsAzurePowershellCmdlet importAzurePublishSettingsFile = new WindowsAzurePowershellCmdlet(importAzurePublishSettingsFileCmdlet); var i = importAzurePublishSettingsFile.Run(); Console.WriteLine(i.ToString()); }
/// <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)); }
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); }
/// <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); }
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; }
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; }
// 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; }
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); }
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); }
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); }
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; }
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; }
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; }
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; }
public Collection<SubscriptionData> GetAzureSubscription() { GetAzureSubscriptionCmdletInfo getAzureSubscriptionCmdlet = new GetAzureSubscriptionCmdletInfo(); WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(getAzureSubscriptionCmdlet); Collection<SubscriptionData> subscriptions = new Collection<SubscriptionData>(); foreach (PSObject result in azurePowershellCmdlet.Run()) { subscriptions.Add((SubscriptionData)result.BaseObject); } return subscriptions; }
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; }
// 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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
public void RemoveAzureVM(string vmName, string serviceName) { RemoveAzureVMCmdletInfo removeAzureVMCmdletInfo = new RemoveAzureVMCmdletInfo(vmName, serviceName); WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureVMCmdletInfo); Collection<PSObject> result = azurePowershellCmdlet.Run(); }
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; }
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; }
public void RemoveAzureStorageAccount(string storageAccountName) { var removeAzureStorageAccountCmdletInfo = new RemoveAzureStorageAccountCmdletInfo(storageAccountName); var azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureStorageAccountCmdletInfo); Collection<PSObject> result = azurePowershellCmdlet.Run(); }
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; }
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; }
public void RemoveAzureStorageAccount(string storageAccountName) { var removeAzureStorageAccountCmdletInfo = new RemoveAzureStorageAccountCmdletInfo(storageAccountName); var azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(removeAzureStorageAccountCmdletInfo); Collection <PSObject> result = azurePowershellCmdlet.Run(); }
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; }
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; }
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; }