Introduction
While creating Azure Function App, by default Application Insights are enabled in the monitoring tab. Enabling Application Insights to your function app is useful to monitor the app and it collects log(failed request, server response time, server request and availability), performance, and error data, and automatically detects performance anomalies in your function app. It is always recommended to enable Application Insights for function apps.
Below screenshot is captured during Function App creation where Application Insights is selected to Yes by default but explicitly we have opted No to enable Application Insights later.
Fig 1: Azure Function App - Enable Application Insights is Yes be default
Review Application Settings
Once App is created , navigate to configuration tab under Settings and you do not see any application settings related to Application Insights.
Fig 2 : Azure Function App - App settings without insights
With No option being selected during Function App creation, Application Insights are not available for your function app. Now, let's see how to enable Application Insights for existing Azure Function App using Azure Portal.
Enable Application Insights
Open your Function App and you can see a link “click here to access Application Insights for monitoring and profile for your app” from Function App Overview details.
Fig 3 : Azure Function App - Open Application Insights
Click on the link and it opens the Enable Application Insights page.
Fig 4 : Azure Function App - Turn on Application Insights
Click on the Turn on Application Insights button which open Enable Application Insights page where you can enter Resource name and location to have the Insights. Better you select the same location as your Function App.
Fig 5 : Azure Function App - Enable Application Insights
Fig 6 : Azure Function App - Enable Application Insights confirmation
Click on the Apply and Yes button, and after sometime your Function App is mapped with Application Insights.
Review Application Settings
Now if you go back to Application settings, there will be 3 app insights settings added to your application configuration settings.
Fig 7: Azure Function App - App settings with insights
Now, your Function App is ready with Application insights to collect data.