How to setup automation task and alerts

Arun Pun 0 Reputation points
2025-03-21T10:48:20.8233333+00:00

Hi all,

I currently have an app service plan with 3 instances and a few web apps running on it.

I want to setup a process so that if an instance of a web app becomes unhealthy or degraded, that instance is restarted. After restarting this instance, it is to be somehow monitored for a few minutes and if it is still unhealthy, then an alert is triggered.

When creating an alert rule and selecting 'Health Check Status' as the signal, it is unclear to me what the condition should be, i.e. how do I set logic to say that an instance is 'unhealthy/degraded'?

I've looked into azure automations, runbooks, schedules, webhook but having trouble putting the pieces together to setup the process as I'm not sure which azure resource should I be using here and how they should be used.

Any response or guidance would be very much appreciated.

Thank you!

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,351 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 44,515 Reputation points MVP
    2025-03-21T11:57:58.39+00:00

    You might want to consider using the Auto Heal functionality - as described in https://www.serverlessnotes.com/docs/auto-restart-an-unhealthy-web-app

    More at https://learn.microsoft.com/en-us/answers/questions/1368033/how-to-programmatically-restart-an-instance-of-an

    https://learn.microsoft.com/en-us/azure/app-service/monitor-instances-health-check?tabs=dotnet and

    https://learn.microsoft.com/en-us/azure/app-service/monitor-instances-health-check?tabs=dotnet


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.