【问题标题】:Azure Startup run book stop working, not sure what happened?Azure 启动运行手册停止工作,不确定发生了什么?
【发布时间】:2016-06-07 10:57:27
【问题描述】:

以下脚本运行了一段时间,不知道为什么我不断收到此错误:

Select-AzureSubscription :带有 MSDN 的订阅名称 Visual Studio Ultimate 不存在。 参数名称:名称

...等等..

Get-AzureVM:未指定默认订阅。使用 Select-AzureSubscription -Default 来 设置默认订阅。 在 RICSVMStartup:13 char:13

这是powerscript:

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 
    }
}

【问题讨论】:

    标签: powershell azure runbook


    【解决方案1】:

    简而言之,你必须有一个server administrator帐户并创建一个AD帐户,在SETTING>Administrators中将新的AD帐户设置为共同管理员,在Automation>ASSET中将新的AD帐户设置为凭据,然后运行你的代码:$Cred = Get-AutomationPSCredential -Name 'your new AD account'。以上答案参考更多信息链接。

    【讨论】:

    • 我已经设置了 AD 用户...我尝试登录以查看密码是否更改...似乎问题与需要分配订阅的用户有关。
    • 没关系,想通了!非常感谢,已解决问题。
    • 我现在才看到您的问题,您需要将新的 AD 帐户设置为共同管理员。我很高兴你能解决它。
    【解决方案2】:

    我在使用 Live Id 作为凭据连接到 Azure 时遇到这些错误。解决方案是使用 Azure Active Directory OrgID 基于凭据的身份验证,请按照this blog 中的步骤创建 Azure AD 用户,然后使用 OrgId 创建自动化凭据资产。

    更多信息请参考本帖https://social.msdn.microsoft.com/Forums/en-US/055f9830-3bf1-48f4-908b-66ddbdfc2d95/authenticate-to-azure-via-addazureaccount-with-live-id?forum=azureautomation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-27
      • 2021-04-10
      • 1970-01-01
      • 2020-01-18
      • 1970-01-01
      • 1970-01-01
      • 2018-10-31
      • 1970-01-01
      相关资源
      最近更新 更多