Configure Application Insights¶
Application Insights provides telemetry logging and the in-portal Application Insights Dashboard (performance metrics, error tracking, usage analytics, health monitoring). There are two parts to configure.
Part A: connection string (telemetry and logging)¶
The APPLICATIONINSIGHTS_CONNECTION_STRING environment variable enables telemetry collection (logs, traces, exceptions). If you deployed via the ARM/Bicep template, this is already set automatically.
To verify or set manually:
- Go to Azure Portal > your Resource Group.
- Select the Application Insights resource (for example,
ai-apprequest-prod). - On the Overview page, copy the Connection String (select the copy icon).
- Go to your App Service > Configuration > Application settings.
- Add or verify the setting:
- Name:
APPLICATIONINSIGHTS_CONNECTION_STRING - Value: The connection string you copied (starts with
InstrumentationKey=...) - Select Save and restart the App Service.
Part B: App ID and API key (metrics dashboard)¶
The in-portal Application Insights Dashboard tab uses the Application Insights REST API. This requires an App ID and API key, which are separate from the connection string.
Without these settings, the dashboard still works but uses database-only metrics (no direct Application Insights API queries).
To configure:
- Go to Azure Portal > your Resource Group.
- Select the Application Insights resource.
Get the App ID:
- In the left menu, select API Access (under Configure).
- Copy the Application ID (this is the App ID, not the Instrumentation Key).
Create an API key:
- On the same API Access page, select Create API key.
- Enter a description:
App Store for Intune Metrics Dashboard. - Check Read telemetry under permissions.
- Select Generate key.
- Copy the key immediately. It won't be shown again.
Add to App Service:
- Go to your App Service > Configuration > Application settings.
- Add two settings:
- Name:
ApplicationInsights__AppId, Value: The Application ID from step 4 - Name:
ApplicationInsights__ApiKey, Value: The API key from step 9
- Name:
- Select Save and restart the App Service.
Note
Use double underscores (__) in the setting names. This is how ASP.NET Core maps environment variables to the ApplicationInsights:AppId configuration path.
Note
For local development, add these to appsettings.json under an ApplicationInsights section:
Verify Application Insights¶
After configuration, verify it's working:
- Go to Admin > Application Insights tab in the portal.
- You should see performance metrics, error counts, and usage data.
- If you see "Application Insights is not configured", check that both
ApplicationInsights__AppIdandApplicationInsights__ApiKeyare set correctly.
For detailed troubleshooting, see Troubleshooting.
Next steps¶
- Read the Admin Guide to learn how to configure the portal through the web UI
- Configure Conditional Access policies for enhanced security
- Set up Azure Monitor and Application Insights for monitoring
- Customize the UI to match your organization's branding