Home > OS >  Is there an Azure CLI command for getting Health Check status from Function App?
Is there an Azure CLI command for getting Health Check status from Function App?

Time:02-17

I've created a Function App, and everything seems to be running fine. In the Azure Portal, Function App Overview I can see that the Health Check is "100.00% (Healthy 2 / Degraded 0)", and on the Health Check page of the Function App I can see that it's enabled and the endpoint is "api/health".

Is there a way to get the "100% (Healthy 2 / Degraded 0)" through an Azure CLI command. It looks like az functionapp list only gives me the siteConfig.healthCheckPath value and that's not what I need.

enter image description here

CodePudding user response:

You can fetch the values of Health Check Status metric by using the Azure CLI command az monitor metrics list as described here https://docs.microsoft.com/en-us/cli/azure/monitor/metrics?view=azure-cli-latest#az-monitor-metrics-list.

Example: az monitor metrics list --resource myresource --resource-group myresourcegroup --resource-type "Microsoft.Web/sites" --metric "HealthCheckStatus" --interval 5m

Note that the --interval property is important as health checks do not support the default 1m interval used by az monitor metrics list

  • Related