我想在Azure中停止并取消分配Windows VM。
在PowerShell中,我使用命令:
Stop-AzureVM - ServiceName [servicename] - Name [machinename] - Force
但是,我在PowerShell中收到以下错误消息:
警告:“在服务中找不到部署[servicename]
可能出现什么问题?
答案 0 :(得分:2)
疑难解答步骤:
VM是否已处于关闭或取消分配状态。
您有多个订阅吗?如果是,则使用以下cmdlet选择正确的订阅,然后尝试停止VM:
Select-AzureSubscription -SubscriptionName "<<Your SubscriptionName here>>"
或
Select-AzureSubscription -Id "<<Your Subscription ID>>"
如果您只有一个Azure订阅,则检查您是否使用ASM创建了VM,即旧门户(https://manage.windowsazure.com)或ARM,即新门户(https://portal.azure.com)。如果您使用了新门户,则需要使用与ARM相关的PowerShell cmdlet,如下所示:
Stop-AzureRmVM -ResourceGroupName "resource group name" -Name "VM name"
ARM PowerShell cmdlet参考:Azure Resource Manager and PowerShell