Application Insights helps us to track applications health in real time. You can track your application availability, performance issues, user’s session and diagnose crashes faster than ever. It provides a real-time dashboard for your app to monitor your application. It is fast, very easy to configure and provide very powerful insights for your application. We can capture the real-time telemetry using Application Insights for our Azure Function App as well. There are several ways to do that integration.
Integrate Application Insights While Creating your Azure Function App
Navigate and Login to your Azure Portal, From New -> Compute -> Select Function App, or Search Function App in the Search the marketplace box. Then Create the Function App, by providing all required details including App Name, Subscription Details, Hosting Plan etc.
To enable the Application Insight, set the last option “Application Insights“ to ON.
Fig: Integrate Application Insight while creating Azure Function App
With that, along with creating your Azure Function App, you will have an Application Insight created with mapped with current Azure Function.
Using existing Application Insights for Azure Function App
If you have Application Insight already created and you want to integrate it with your Azure Function App, you can do that easily post your Azure Function is created.
Once you Azure Function is created, and you don’ t have configuration done, you will find Configured Features is empty under Overview Tab.
Fig: Configuration Tab
Navigate to “Platform Features” Tab and under General Settings, select “Applications Settings”
Fig : Application Settings
There along with other settings add a new entry for Application Insights
APPINSIGHTS_INSTRUMENTATIONKEY = <Instrumentation Key>
Follow the Steps to get the Instrumentation Key for an Application Insights: Application Insights Settings –> Properties –> Instrumentation Key
Fig: Getting Instrumentation Key
Once Application Settings is updated, you may go back again to Overview Tab. Now you will find “Application Insights” is listed under Configured Features. It may take a while to appear in this list.
Fig: Azure Function App Configuration List
Click on the Application Insights link, it will open the Application Insight Dashboard from where you can start monitoring and review all telemetry data.
Fig: Application Insights Dashboard for Azure Function App