This is how the entire process works:
- We created the Azure Function using the default Application Insights Scheduled Analytics template.
- We configured the following keys in the Application settings of the Azure function app:
- Application Insights's Instrumentation Key
- The application ID
- The API access key
- The Azure function runtime automatically consumed the Application Insights API, ran the custom query to retrieve the required metrics, and performed the required operations to feed the derived telemetry data to Application Insights.
- Once everything in the Azure function was configured, we developed a simple query that pulled the request count of the last hour and fed it to Application Insights as a custom derived metric. This process repeated every hour.
- Later, we configured a new report using Application Insights Metrics with our custom derived metric.