是否可以从云中的工作者角色运行蔚蓝的powershell cmdlet?
如果是这样的话,有没有人设法做到这一点,并能提供某种解释,如何得到所有的设置?
到目前为止我有这个,但行不通。
using (PowerShell powerShell = PowerShell.Create())
{
powerShell.AddCommand("Set-ExecutionPolicy");
powerShell.AddParameter("ExecutionPolicy", "RemoteSigned");
Collection<PSObject> output = powerShell.Invoke();
ProcessPowerShellOutput(output);
powerShell.AddCommand("Import-Module");
powerShell.AddParameter("Name", "Azure");
output = powerShell.Invoke();
ProcessPowerShellOutput(output);
powerShell.AddCommand("Import-AzurePublishSettingsFile");
powerShell.AddParameter("PublishSettingsFile", @"<PATH>");
output = powerShell.Invoke();
ProcessPowerShellOutput(output);
powerShell.AddCommand("Set-AzureSubscription");
powerShell.AddParameter("SubscriptionName", @"SUB NAME");
output = powerShell.Invoke();
ProcessPowerShellOutput(output);
powerShell.AddCommand("Set-AzureRole");
powerShell.AddParameter("ServiceName", @"deploymentconfigtest");
powerShell.AddParameter("Slot", @"Production");
powerShell.AddParameter("RoleName", @"DummyWorkerRole");
powerShell.AddParameter("Count", 2);
output = powerShell.Invoke();
ProcessPowerShellOutput(output);
}这就是我使用powershell控制台运行的内容,它在那里运行得很好。
任何帮助都是非常感谢的。
谢谢
史蒂夫
发布于 2016-01-08 09:18:27
我通过使用C# .NET库实现了这一点,
Nuget:https://www.nuget.org/packages?q=Microsoft.WindowsAzure.Management
https://stackoverflow.com/questions/26625699
复制相似问题