Skip to content

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 & 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:

  1. Go to Azure Portal > your Resource Group
  2. Click on the Application Insights resource (e.g., ai-apprequest-prod)
  3. On the Overview page, copy the Connection String (click the copy icon)
  4. Go to your App Service > Configuration > Application settings
  5. Add or verify the setting:
  6. Name: APPLICATIONINSIGHTS_CONNECTION_STRING
  7. Value: The connection string you copied (starts with InstrumentationKey=...)
  8. Click Save and restart the App Service

Part B: App ID & 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:

  1. Go to Azure Portal > your Resource Group
  2. Click on the Application Insights resource

Get the App ID:

  1. In the left menu, click API Access (under Configure)
  2. Copy the Application ID (this is the App ID, NOT the Instrumentation Key)

Create an API Key:

  1. On the same API Access page, click Create API key
  2. Enter a description: App Store for Intune Metrics Dashboard
  3. Check Read telemetry under permissions
  4. Click Generate key
  5. Copy the key immediately. It won't be shown again.

Add to App Service:

  1. Go to your App Service > Configuration > Application settings
  2. Add two settings:
    • Name: ApplicationInsights__AppId, Value: The Application ID from step 4
    • Name: ApplicationInsights__ApiKey, Value: The API key from step 9
  3. Click 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:

{
  "ApplicationInsights": {
    "AppId": "your-app-id",
    "ApiKey": "your-api-key"
  }
}

Verifying Application Insights

After configuration, verify it's working:

  1. Navigate to Admin > Application Insights tab in the portal
  2. You should see performance metrics, error counts, and usage data
  3. If you see "Application Insights is not configured", check that both ApplicationInsights__AppId and ApplicationInsights__ApiKey are 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