I deployed my application to Azure App Service and I want to ensure its health after the deployment. How can I check the health of my Azure App Service application programmatically or through automated processes? Specifically, I'm interested in post-deployment health checks to verify that the new version is functioning correctly. If the health check failed would want to rollback to previous version along with sending notification in MS Teams/email.
I tried a way where I waited for the deployment to succeed by pausing execution (Sleeping in Github actions for 6 minutes) because the deployment takes around 6 minutes. Afterward, I made an HTTPS call to the health endpoint. If the response indicated failure, I sent a notification and performed a rollback. Otherwise, no further action was necessary. However, using this approach in GitHub Actions would lead to increased costs since the waiting time of 6 minutes is billable.
Are there any specific way in Azure like Webhook/APIs, or techniques that can help me accomplish this? Any guidance or code examples would be greatly appreciated.
Note: I want to accomplish this using Azure App Service Only (No plan of using Azure Kubernetes Service)
We have various options to check the health status of Azure App service
.
Azure Monitoring:
Health Check:
Add metric
=> select the metric Health check status
.Refer this MSDoc on how to How to Monitor App Service instances using Health check for more details.
how can I rollback to previous version if the app is unhealthy
To roll back the app to the previous version we can use deployment slots.