Forum Discussion

teja1027's avatar
teja1027
Copper Contributor
Mar 29, 2023
Solved

Automation Accounts to Start/Stop VM

Hi Team,

 

I'm trying to trace down why one the VMs is starting on its own, even though it is stopped manually. I went and checked the automation accounts and it has so many runbooks inside and it is difficult for me  to takedown each job and see if this VM is provided on that specific runbook. Is there a way to verify that.

 

Thankyou.

2 Replies

  • josequintino's avatar
    josequintino
    Iron Contributor
    Hi teja1027 It can be challenging to track down the cause of a VM starting on its own, especially when you have multiple runbooks in your Automation Account. Here are some steps to help you identify the runbook responsible for starting the VM: 1- List all runbooks related to starting or stopping VMs: You can filter runbooks by their names or descriptions to identify potential runbooks responsible for starting VMs. Look for keywords like "start", "stop", "VM", or the VM's name. 2- Review the runbook code: Once you have a list of potential runbooks, review their code to identify which ones have the logic for starting VMs. Look for cmdlets like Start-AzVM, Stop-AzVM, or any custom code that could initiate a VM startup. 3- Check runbook job history: Go through the job history for each identified runbook to see if there's a correlation between the job's execution time and the unexpected VM startup. You can find the job history in the Azure portal under the respective runbook. 4- Audit logs: Review the Azure Activity Log or any custom logging implemented in the runbooks to identify events related to the VM in question. You can filter the logs by resource, event type, or time range to narrow down your search. 5- Disable suspected runbooks: If you have narrowed down the potential runbooks responsible for starting the VM, you can temporarily disable them to confirm whether the issue persists. Make sure to communicate with your team and monitor the impact of disabling the runbook on other VMs or processes. 6- Automation Account schedules: Review the schedules associated with your Automation Account to see if there are any schedules triggering the VM startup. If you find a schedule associated with the VM in question, you can disable or modify it to prevent the VM from starting unexpectedly. By following these steps, you should be able to identify the runbook responsible for the unexpected startup of the VM. Once you have pinpointed the cause, you can modify the runbook or its schedule to prevent the issue from occurring in the future.

Resources