Stop-AzureVM does not shutdown my Azure-VM (Runbook)

戏子无情 提交于 2019-12-25 01:39:48

问题


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:


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.



来源:https://stackoverflow.com/questions/29027625/stop-azurevm-does-not-shutdown-my-azure-vm-runbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!