Tools

Health Check Azure App Services

The Health Check feature allows you to specify a path on your application for App Service to ping. If an instance fails to respond to the ping, the system determines it is unhealthy and removes it from the load balancer rotation. This increases your application’s average availability and resiliency.

Behavior

When the instance is unhealthy and removed from the load balancer, the service continues to ping it. If it begins responding with successful response codes, then the instance is returned to the load balancer. If it continues to respond unsuccessfully, App Service will restart the underlying VM in an effort to return the instance to a healthy state.

Health Check integrates with App Service’s authentication and authorization features, so the system will reach the endpoint even if these security features are enabled. If you are using your own authentication system, the health check path must allow anonymous access.

The health check path should check the critical components of your application. For example, if your application depends on a database and a messaging system, the health check endpoint should connect to those components. If the application cannot connect to a critical component, then the path should return a HTTP error response code to indicate that the app is unhealthy.

Official Documentation:

https://azure.github.io/AppService/2020/08/24/healthcheck-on-app-service.html

How to setup the Health Check path in the Azure Portal

  1. Go to the Azure Portal            
  2. Go to the App Service
  3. Then go to the Monitoring Section from the left menu.
  4. Health Check
  5. Add the Health Check Path
  6. Click on save.

 Note: Saving the changes will generate a restart of the application.

If you want to make sure that your health check path was added successfully, please use the following URL: https://resources.azure.com/ to check that you added the path correctly in your web application. You will need to follow the next steps:

Go to https://resources.azure.com/

  1. Expand your subscription.
  2. Go to Resource Groups.
  3. Select the Resource Group where the app service is hosted.
  4. The select providers.
  5. Then select Microsoft Web.
  6. Open sites
  7. And open your app service.
  8. Then open config.
  9. And lastly web.
  10. You will need to scroll to the bottom to find the variable called ‘healthCheckPath’ and you will see the value there for the path you set in the portal.

How to see and analyze Health Check metrics from the Azure Portal

  1. Go to Health Check.
  2. Metrics.

Once you are in the metrics section, you will be able to see the Health Check status of your application:

You can also select the option ‘Apply Splitting’ by instance to see the Health Check status in each of your App Service Plan instances:

2 thoughts on “Health Check Azure App Services

  1. Thank for your detailed article !
    On the Health Check status metric, could you explain how to interpret the value ?
    In your example I see values of “0” or “0.84” what does that mean ?

    1. Hello Pierre-Jean! Thank you for your feedback. The values in the metrics represents the percentage of availability of that specific instance. The ideal value of a healthy instance shoudl be 100%. I hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *