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.
Must Read : 5 simple steps to create and test your first Azure Function App
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
Must Read : Getting an Application Insights Instrumentation Key inside Visual Studio itself
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
Pingback: Dew Drop - May 22, 2017 (#2484) - Morning Dew
Thanks for sharing this Excelent Post. I have a question: i have mi Azure Function integrated with App Insights and i can see the logs in the portal. But, is it possible to see the logs directly in Visual Studio when i debugging my azure functions locally?. Something as this https://docs.microsoft.com/en-us/azure/application-insights/app-insights-visual-studio, but with Azure Functions.
Thanks for the Feedback. Appreciate it. Regarding your query, I think you can view the Application Insights details inside Visual Studio, irrespective of the services your using it. Which means, While debugging your Azure Function, if you connect the respective App Insights resources , in Visual Studio, you should be able to see the logs as long as your are sending back the telemetry. Are you facing some challenges ? Let me know.
Thanks.