Services start/stop automatically in azure

GVS 146 Reputation points
2020-07-05T05:45:11.207+00:00

Hi , Anyone please help me to know how to start a service if stopped in windows azure VM automatically without manual intervention

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,318 questions
{count} votes

3 answers

Sort by: Most helpful
  1. T. Kujala 8,706 Reputation points
    2020-07-05T07:35:24.197+00:00

    Hi @AzureisMyCareer-5423,

    Open the Service management console on the server.

    Start --> Run --> services.msc

    Select the correct service and the Recovery tab.

    Select First failure --> Restart the Service.

    11378-restart-the-service.jpg

    0 comments No comments

  2. Dave Patrick 426.3K Reputation points MVP
    2020-07-05T15:06:22.94+00:00

    Much more bullet proof method is to script it something like this and run as a periodic scheduled task.

    https://gallery.technet.microsoft.com/scriptcenter/f6449995-6fd3-4a37-8afd-bcc7f5388c6b

    --please don't forget to Accept as answer if the reply is helpful--


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.


  3. shivakumarky 1 Reputation point
    2021-05-11T20:08:24.507+00:00

    Hi,

    Even i have not came across any solution so far to start services when they got stopped. One solution is to configure restart service on failure and i was thinking of building below solution.

    1. Implement Change Tracking in Automation Account for your VM's which are reporting to workspace
    2. Create a Log analytics alert to trigger the alert whenever any VM service goes down. Instead of triggering the email alert, trigger a runbook action.
    3. Configure the runbook to utilize common schema alert and based on the values in the alert, runbook should invoke the "run command" on VM directly to start the service which is stopped. Or we can try to use custom script extension or desired state configuration based on our solution requirement.
    4. If the runbook could not start the service then it should trigger the alert to IT Team to check and resolve the issue.

    Below is the link with similar solution implemented by Github team :
    https://github.com/azureautomation/runbooks/blob/master/Utility/ARM/Restart-ServiceFromAzureAlert.ps1