Enable Profiler for web apps on an Azure virtual machine


We recommend that you use the Azure Az PowerShell module to interact with Azure. See Install Azure PowerShell to get started. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

In this article, you learn how to run Application Insights Profiler on your Azure virtual machine (VM) or Azure virtual machine scale set via three different methods. Using any of these methods, you will:

  • Configure the Azure Diagnostics extension to run Profiler.
  • Install the Application Insights SDK onto a VM.
  • Deploy your application.
  • View Profiler traces via the Application Insights instance on Azure portal.


Add Application Insights SDK to your application

  1. Open your ASP.NET core project in Visual Studio.

  2. Select Project > Add Application Insights Telemetry.

  3. Select Azure Application Insights, then click Next.

  4. Select the subscription where your Application Insights resource lives, then click Next.

  5. Select where to save connection string, then click Next.

  6. Select Finish.


For full instructions, including enabling Application Insights on your ASP.NET Core application without Visual Studio, see the Application Insights for ASP.NET Core applications.

Confirm the latest stable release of the Application Insights SDK

  1. Go to Project > Manage NuGet Packages.

  2. Select Microsoft.ApplicationInsights.AspNetCore.

  3. In the side pane, select the latest version of the SDK from the dropdown.

  4. Select Update.

    Screenshot of where to select the Application Insights package for update.

Enable Profiler

You can enable Profiler by any of the following three ways:

  • Within your ASP.NET Core application using an Azure Resource Manager template and Visual Studio (recommended).
  • Using a PowerShell command via the Azure CLI.
  • Using Azure Resource Explorer.

Install the Azure Diagnostics extension

  1. Choose which Azure Resource Manager template to use:

  2. In the template, locate the resource of type extension.

  3. In Visual Studio, navigate to the arm.json file in your ASP.NET Core application that was added when you installed the Application Insights SDK.

  4. Add the resource type extension from the template to the arm.json file to set up a VM or virtual machine scale set with Azure Diagnostics.

  5. Within the WadCfg tag, add your Application Insights instrumentation key to the MyApplicationInsightsProfilerSink.

"WadCfg": {
  "SinksConfig": {
    "Sink": [
        "name": "MyApplicationInsightsProfilerSink",
  1. Deploy your application.

Can Profiler run on on-premises servers?

Currently, Application Insights Profiler is not supported for on-premises servers.

Next steps

Learn how to...