Enable Profiler for Azure App Service apps
Application Insights Profiler is preinstalled as part of the Azure App Service runtime. You can run Profiler on ASP.NET and ASP.NET Core apps running on App Service by using the Basic service tier or higher. Follow these steps, even if you included the Application 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.
Prerequisites
- An Azure App Service ASP.NET/ASP.NET Core app.
- An Application Insights resource connected to your App Service app.
Verify the "Always on" setting is enabled
In the Azure portal, go to your App Service instance.
Under Settings on the left pane, select Configuration.
Select the General settings tab.
Verify that Always on > On is selected.
Select Save if you made changes.
Enable Application Insights and Profiler
The following sections show you how to enable Application Insights for the same subscription or different subscriptions.
For Application Insights and App Service in the same subscription
If your Application Insights resource is in the same subscription as your instance of App Service:
Under Settings on the left pane, select Application Insights.
Under Application Insights, select Enable.
Verify that you connected an Application Insights resource to your app.
Scroll down and select the .NET or .NET Core tab, depending on your app.
Verify that Collection level > Recommended is selected.
Under Profiler, select On.
If you chose the Basic collection level earlier, the Profiler setting is disabled.
Select Apply > Yes to confirm.
For Application Insights and App Service in different subscriptions
If your Application Insights resource is in a different subscription from your instance of App Service, you need to enable Profiler manually by creating app settings for your App Service instance. You can automate the creation of these settings by using a template or other means. Here are the settings you need to enable 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 by using:
Enable Profiler for regional clouds
Currently, the only regions that require endpoint modifications are Azure Government and Microsoft Azure operated by 21Vianet.
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 Microsoft Entra authentication for profile ingestion
Application Insights Profiler supports Microsoft Entra authentication for profile 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 Microsoft Entra authentication when you reference and configure Microsoft Entra ID by using the Application Insights SDK in your application.
To enable Microsoft Entra ID for profile ingestion:
Create and add the managed identity to authenticate against your Application Insights resource to your App Service:
Configure and enable Microsoft Entra ID in your Application Insights resource.
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:
Under Settings on the left pane, select WebJobs.
Select the webjob named
ApplicationInsightsProfiler3
.Select Stop.
Select Yes to confirm.
We recommend that you have Profiler enabled on all your apps to discover any performance issues as early as possible.
You can delete Profiler's files when you use 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 generate load and view Profiler traces
- Learn how to use the Code Optimizations feature alongside the Application Insights Profiler
Feedback
Submit and view feedback for