Stop-AzureVM does not shutdown my Azure-VM (Runboo

2019-08-22 10:53发布

Hy

I've an Azure VM with Visual Studio installed. When I run the Shutdown script (Runbook)from here: https://gallery.technet.microsoft.com/scriptcenter/Stop-Azure-Virtual-Machine-0b1fea97

Script Status says it is completed but it did not shut down my VM. Output says Shutting down but nothing happens.

Any suggestions on this?

Thanks for your Help. Peter

1条回答
来,给爷笑一个
2楼-- · 2019-08-22 11:32

I would suggest you few things-

a. Most imp- Go to ASSET tab and add proper windows powershell credentials (simply you can use username and password, the same you use to login to azure portal).

b. Add your code in the runbook. Suppose your powershell automation credential name is StartVM and your subscription name is xxx. In this case the workflow will be-

workflow StartVM
{
$Cred = Get-AutomationPSCredential -Name
StartVM' Add-AzureAccount -Credential $Cred
Select-AzureSubscription -SubscriptionName “xxx”
inlineScript
{
Start-AzureVM -Name TestServer -ServiceName CS12345
}
}

c. After this you can schedule your runbook as per your need.

Hope this one will help you-

http://azure.microsoft.com/blog/2014/11/25/introducing-the-azure-automation-script-converter/ http://azure.microsoft.com/en-us/documentation/articles/automation-create-runbook-from-samples/

Thanks.

查看更多
登录 后发表回答