Enable Profiler for Azure App Service apps

Application Insights Profiler is pre-installed as part of the App Services runtime. You can run Profiler on ASP.NET and ASP.NET Core apps running on Azure App Service using Basic service tier or higher. Follow these steps even if you've included the App Insights SDK in your application at build time.

To enable Profiler on Linux, walk through the ASP.NET Core Azure Linux web apps instructions.

Note

Codeless installation of Application Insights Profiler follows the .NET Core support policy.
For more information about supported runtime, see .NET Core Support Policy.

Pre-requisites

Verify "Always On" setting is enabled

  1. In the Azure portal, navigate to your App Service.

  2. Under Settings in the left side menu, select Configuration.

    Screenshot of selecting Configuration from the left side menu.

  3. Select the General settings tab.

  4. Verify Always On > On is selected.

    Screenshot of the General tab on the Configuration pane and showing the Always On being enabled.

  5. Select Save if you've made changes.

Enable Application Insights and Profiler

For Application Insights and App Service in the same subscription

If your Application Insights resource is in the same subscription as your App Service:

  1. Under Settings in the left side menu, select Application Insights.

    Screenshot of selecting Application Insights from the left side menu.

  2. Under Application Insights, select Enable.

  3. Verify you've connected an Application Insights resource to your app.

    Screenshot of enabling App Insights on your app.

  4. Scroll down and select the .NET or .NET Core tab, depending on your app.

  5. Verify Collection Level > Recommended is selected.

  6. Under Profiler, select On.

    • If you chose the Basic collection level earlier, the Profiler setting is disabled.
  7. Select Apply, then Yes to confirm.

    Screenshot of enabling Profiler on your app.

For Application Insights and App Service in different subscriptions

If your Application Insights resource is in a different subscription from your App Service, you'll need to enable Profiler manually by creating app settings for your Azure App Service. You can automate the creation of these settings using a template or other means. The settings needed to enable the Profiler:

App Setting Value
APPINSIGHTS_INSTRUMENTATIONKEY iKey for your Application Insights resource
APPINSIGHTS_PROFILERFEATURE_VERSION 1.0.0
DiagnosticServices_EXTENSION_VERSION ~3

Set these values using:

Enable Profiler for regional clouds

Currently the only regions that require endpoint modifications are Azure Government and Azure China.

App Setting US Government Cloud China Cloud
ApplicationInsightsProfilerEndpoint https://profiler.monitor.azure.us https://profiler.monitor.azure.cn
ApplicationInsightsEndpoint https://dc.applicationinsights.us https://dc.applicationinsights.azure.cn

Enable Azure Active Directory authentication for profile ingestion

Application Insights Profiler supports Azure AD authentication for profiles ingestion. For all profiles of your application to be ingested, your application must be authenticated and provide the required application settings to the Profiler agent.

Profiler only supports Azure AD authentication when you reference and configure Azure AD using the Application Insights SDK in your application.

To enable Azure AD for profiles ingestion:

  1. Create and add the managed identity to authenticate against your Application Insights resource to your App Service.

    a. System-Assigned Managed identity documentation

    b. User-Assigned Managed identity documentation

  2. Configure and enable Azure AD in your Application Insights resource.

  3. Add the following application setting to let the Profiler agent know which managed identity to use:

    For System-Assigned Identity:

    App Setting Value
    APPLICATIONINSIGHTS_AUTHENTICATION_STRING Authorization=AAD

    For User-Assigned Identity:

    App Setting Value
    APPLICATIONINSIGHTS_AUTHENTICATION_STRING Authorization=AAD;ClientId={Client id of the User-Assigned Identity}

Disable Profiler

To stop or restart Profiler for an individual app's instance:

  1. Under Settings in the left side menu, select WebJobs.

    Screenshot of selecting web jobs from the left side menu.

  2. Select the webjob named ApplicationInsightsProfiler3.

  3. Click Stop from the top menu.

    Screenshot of selecting stop for stopping the webjob.

  4. Select Yes to confirm.

We recommend that you have Profiler enabled on all your apps to discover any performance issues as early as possible.

Profiler's files can be deleted when using WebDeploy to deploy changes to your web application. You can prevent the deletion by excluding the App_Data folder from being deleted during deployment.

Next steps

Learn how to...