下面的脚本工作了一段时间,不知道为什么我不断收到这个错误:
Select-AzureSubscription :带有 MSDN 的订阅名称 Visual Studio Ultimate 不存在。参数名称:名称
...ETC..
Get-AzureVM :未指定默认订阅。使用 Select-AzureSubscription -Default 设置默认订阅。在 RICSVMStartup:13 char:13
这是电源脚本:
workflow RICSVMStartup
{
# Grab the credential to use to authenticate
$Cred = Get-AutomationPSCredential -Name 'AzureCredential'
#Connect to Azure
Add-AzureAccount -Credential $Cred
#Select the Azure subscription you want to work against
Select-AzureSubscription -SubscriptionName "Visual Studio Ultimate with MSDN"
# Get all Azure VMs in the subscription that are not stopped and deallocated and shut down
inlinescript
{
Get-AzureVM | where{$_.status -ne 'Started' -and $_.name -like 'RICS*' -and $_.name -ne 'RICSDC2'} | start-AzureVM
}
}