Earlier this month Azure Functions was updated to have direct integration with Application Insights and is currently only available on the “beta” version of Azure Functions. At this time it’s recommended to only try this out in non-production Azure Function apps until it’s a more stable release.
Getting Started
Before we can enable Azure Function Application Insights integration, we will need to setup an Application Insights instance. If you already have one skip to the next step.
- Create an Application Insights instance and Application Type should be General. Once your Application Insights is setup, copy the instrumentation key which we’ll need in the next step.
- Next you will need to update your Azure Function Application Settings to configure your function to run under the “beta” version and then to set your Application Insights Instrumentation Key.
- Now go to Application Settings and then update App Setting “FUNCTIONS_EXTENSION_VERSION” from “~1” to “beta” and then add a new key named “APPINSIGHTS_INSTRUMENTATIONKEY” and set the value to the Application Insights Instrumentation key you copied in step 1. Now click Save to update your Azure Function.
Once this is done, your Application Insights instance will start collecting telemetry from your Azure Function without any code changes.
Using Application Insights
Going to your Application Insights, you can start to see some metrics showing up on the overview blade:
Live Metrics Stream
You can get a lot more insights to real-time telemetry from the Live Metrics Stream to see what’s happening right now:

Analytics
Another great resource of Application Insights is the Analytics portal, which provides you the ability to write your own custom queries.

Alerts
The previous two options are great to see what is happening or what happened historically, but Alerts will tell you what’s happening. I suggest you checkout Alerts from the Application Insights blade, where you can define alerts based on a wide array of metrics.

Summary
You can now add Application Insights to your Azure Functions with minimal effort, which is a powerful tool for monitoring your applications. Keep in mind that this is currently only available in the “beta” version of Azure Functions, but is something that should be coming to the production release in the near future now that it’s been merged into the develop branch on github.
Enjoy!
References
Azure Functions integration with Application Insights
Azure Functions now has direct integration with Application Insights
Application Insights
Live Metrics Stream docs
Like this:
Like Loading...