Azure Functions notification on failure

Leigh007 picture Leigh007 · May 5, 2017 · Viewed 8.4k times · Source

I have timer-triggered Azure functions running in production, but now I want to be notified if the function fails.

In my case, access to various connected services can cause crashes, and there are many to troubleshoot. The crash is the type of error I need notification for.

When the function does fail, the log entry indicates failure, so I wonder if there is a hook in the system that would allow me to cause the system to generate a notification.

I know that blob and queue bindings, for instance, support the creation of poison queue entries, but timer trigger binding doesn't say anything about any trigger outputs of that nature.

I see that functions can pass their $return status as input to other functions, but that operation is not explained in depth in the docs. Also, in that case, I need to write another function to process the error status, and I was looking for something built-in.

I Have inquired with @AzureSupport on this, but their answer had nothing to do with Azure Functions, instead referring me to DLL notification hooks, then recommending I file on uservoice.

I'm sure there must be people here who have implemented some sort of error status notification. I prefer a solution that doesn't require code.

Answer

Chris picture Chris · May 31, 2017

The recommended way to monitor and alert on failures is to use AppInsights which integrates fully with Azure Functions now

https://blogs.msdn.microsoft.com/appserviceteam/2017/04/06/azure-functions-application-insights/

Since all the logs are available in AppInsights it's easy to monitor for failures and setup alerts based on your own criteria.

However, if you only care about alerting and not things like monitoring etc, you could use Azure Monitor instead: https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-get-started