Azure Category Image - Addend Analytics

How To Add Alerts In Azure Function Apps

One of the key things when working with any job that runs is that I want to know when the job fails. If I do not have this and I assume that the data is always where I could fall into a situation where there is missing data that I cannot get back. I’ve been fiddling with a better way to receive a notification from an Azure Function that has encountered an exception.

There are probably a few approaches to doing this, some that involve code others that do not. My first choice is to try to take the no-code or low-code approach.

Below explains how to create an alert with a notification email if an Azure Function App fails.

Step 1: Navigate to your function app

Azure Function

 

Step 2: Go to Alerts

Go to Alerts

Step 3: Click New alert rule

New alert rule

Step 4: Click on the default resource selected, which has to be changed.

resource

Step 5: Select the application insights associated with the function app

function app

Step 6: Under Conditions choose “Custom log search”

Custom log search

Step 7: Fill in the query used for evaluation, and other data, then click “Done”

done

Step 8: Click on Add action groups and Create action groups

Create action groups

Step 9: Select the action group which you have created

action group

Step 10: Fill in the details, choose “Email/SMS message/Push/Voice” as the notification type and enter the name of the recipient

name of the recipient

Step 11: Customize the email subject and click “Create alert rule” …. now the rule is live

rule

Summary:

Now, every 1 day the rule will run, if there are any exceptions, an email will be sent. An alert is always based on a query on the telemetry. If we can formulate a query revealing bad behaviours, we can setup an alert on those behaviours.

This is part of the automation of a solution. We do not want to wait for our end users to discover that our site is slow or that some operations are failing. We want to be pro-active. For that, we need visibility and alerts are a great way to make us aware of what is going on.

Of course, alerts are not the only tool at our disposal. Plots & dashboard can also help. In our case, we could have plotted the success rate of the function.

Thanks for reading!

Shubham Kokane
Data Engineer
Addend Analytics

Facebook
Twitter
LinkedIn

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.