【问题标题】:Stop-AzureVM: No deployment found in serviceStop-AzureVM:在服务中找不到部署
【发布时间】:2016-04-21 04:43:07
【问题描述】:

我想在 Azure 中停止并取消分配 Windows VM。

在 PowerShell 中,我使用命令:

Stop-AzureVM - ServiceName [servicename] - Name [machinename] - Force

但是,我在 PowerShell 中收到以下错误消息:

警告:“在服务 [servicename] 中找不到部署

可能出了什么问题?

【问题讨论】:

    标签: powershell azure azure-powershell


    【解决方案1】:

    故障排除步骤:

    1. VM 是否已处于关闭或解除分配状态。

    2. 您是否有多个订阅。如果是,则使用以下 cmdlet 选择正确的订阅,然后尝试停止 VM:

      Select-AzureSubscription -SubscriptionName "<<Your SubscriptionName here>>"
      

      Select-AzureSubscription -Id "<<Your Subscription ID>>"
      
    3. 如果您只有一个 Azure 订阅,请检查您是否使用 ASM(即旧门户(https://manage.windowsazure.com)或 ARM(即新门户)(https://portal.azure.com)创建了 VM。如果您使用新门户,则需要使用与 ARM 相关的 PowerShell cmdlet,如下所示:

      Stop-AzureRmVM -ResourceGroupName "resource group name" -Name "VM name"
      

    ARM PowerShell cmdlet 参考:Azure Resource Manager and PowerShell

    【讨论】:

    • 1. VM 未处于关闭或解除分配状态。 2.我使用了第一个选项,命令成功但没有可见的反馈。 3. 我在新门户中创建了它。 3. 输入命令: Stop-AzureRmVm - ResourceGroupName ,得到如下反馈: 运行 Login-AzureRmAccount 登录。
    • 更新:我输入了Login-AzureRmAccount,然后需要登录,输入登录凭据后,输入Stop-AzureRmVM - ResourceGroupName "name" - Name "name",然后VM就关闭了下来并被释放。如何防止在执行 Stop-AzureRmVM 命令之前首先需要登录?
    • 我相信您不希望弹出式登录并希望它以非交互和完全自动化的方式发生。您可以使用以下代码: $secpasswd = ConvertTo-SecureString “YourPass” -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential (“YourUser”, $secpasswd) Login-AzureRmAccount -Credential $mycreds 您将需要使用 Org 帐户而不是 live id 登录。参考:go.microsoft.com/fwlink/?linkid=331007&clcid=0x409
    猜你喜欢
    • 1970-01-01
    • 2015-05-15
    • 2019-10-01
    • 1970-01-01
    • 2014-12-19
    • 2018-04-10
    • 2014-01-09
    • 2020-02-27
    • 1970-01-01
    相关资源
    最近更新 更多