问题
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