• English日本語한국어
  • Log inStart now

Install the .NET agent on Azure Web Apps

This document explains how to install New Relic's .NET agent for application performance monitoring on your Azure Web App. (This is not the same as installing the infrastructure monitoring integrations for Microsoft Azure.) Recommendation: Before following these instructions, read the .NET agent installation overview.

Installation options

Use any of the following methods to add the New Relic .NET agent to your Azure-deployed web app. The best option depends on your role, environment, deployments, etc. For example:

For operations teams that need to monitor the app, the easiest and most reliable option is to use the publicly maintained Azure site extension.

Note: Azure Site Extensions are only currently available for Windows App Service Resources.

For developer teams, or anyone needing to deploy the agent on a Linux App Service Resource, installing via nuget is the best option:

In order to monitor non-web apps (including WebJobs), or ASP.NET Core apps targeting .NET Framework, you must explicitly enable the agent for that application's .exe process via one of these two methods:

In addition, WebJobs may need custom instrumentation for transactions to appear in APM, and additional configuration if they run for less than one minute.

Disable Application Insights

Both New Relic's .NET agent and Microsoft Application Insights rely on the CLR Profiler, but only one may be active at a time. You must disable Application Insights in order for the .NET agent to function properly. For more information, see our Application Insights troubleshooting procedures.

Install using the New Relic Azure Site Extension (Windows Only)

To install the .NET agent for an Azure Web App using the New Relic Azure Site Extension:

  1. Shut down your web application before installing the New Relic Azure Site Extension.
  2. Add the site extension: Navigate to https://[yoursitename].scm.azurewebsites.net, then select Site extensions > Gallery.
  3. Select the plus icon next to the New Relic site extension.
  4. In the Azure portal, add New Relic app settings to your Azure App Service. This installs the latest .NET agent version. With version 10.x, we dropped support for .NET Framework 4.6.1 and lower and .NET Core 3.0 and lower (see the migration guide). If you need a lower agent version, use the NEWRELIC_AGENT_VERSION_OVERRIDE environment variable. For example: NEWRELIC_AGENT_VERSION_OVERRIDE=9.9.0.
  5. Restart your web app.

Tip

If you've already installed the site extension and set the version override but your application is not reporting, you may need to remove and re-install the site extension for the environment variable to be recognized and for the correct version to be installed.

A couple notes related to this install process:

  • If you need to add a custom instrumentation XML, or modify the base newrelic.config file, you'll find the .NET agent for .NET Framework at %HOME%\NewRelicAgent\Framework, and the agent for .NET Core at%HOME%\NewRelicAgent\Core.
  • This install method monitors all .NET Core applications on the Azure Web Apps instance. If you'd like to disable monitoring for specific .NET Core applications, you can do either of these:

Updating the agent with the New Relic Azure Site Extension

To update the .NET agent for an Azure Web App using the New Relic Azure Site Extension follow the installation instructions to:

  • Install the latest version of the New Relic Azure Site Extension, which updates the agent files to the latest version.
  • Restart the web app to start the updated agent.

Install using NuGet (.NET Framework)

The NuGet installation method packages the New Relic agent with your application so that it is available to the Azure Web App Host.

The NuGet packages in this procedure support only the old packages.config. They do not support the current PackageReference format. For more information, see Microsoft's package reference documentation.

For multi-project solutions, make sure you have selected the correct project (for example, a specific web app project) before installing the NuGet package.

If you're upgrading the .NET Framework agent using NuGet, any changes you made in the newrelic.config will be overwritten. To preserve any changes, save your newrelic.config outside of your project, then restore it after upgrading.

To install the .NET agent on an Azure Web App using NuGet:

  1. In the Azure portal, verify your Azure Platform (32-bit or 64-bit): From the Azure sidebar menu, select App Services > Your Application > Settings > Configuration > General settings.
  2. Open your application in Visual Studio, and install the New Relic NuGet package by running the appropriate command from the Package manager console:
    • 32-bit: Install-Package NewRelic.Azure.WebSites
    • 64-bit: Install-Package NewRelic.Azure.WebSites.x64
  3. Publish your application.
  4. In the Azure portal, open the web app you want to monitor, then select Settings > Configuration.
  5. From Configuration, select + New application setting and add these key/value pairs.

Important

These examples all assume that your Azure Web App uses a D: file system root. If your Azure Web uses a C: root, you need to use the correct drive letter when configuring these paths.

Key

Value

COR_ENABLE_PROFILING

1

COR_PROFILER

{71DA0A04-7777-4EC6-9643-7D28B46A8A41}

COR_PROFILER_PATH

D:\Home\site\wwwroot\newrelic\NewRelic.Profiler.dll

NEWRELIC_HOME

D:\Home\site\wwwroot\newrelic

  1. In the Azure portal, add New Relic app settings to your Azure App Service.
  2. Restart your web app.

Install using NuGet (.NET Core)

The NuGet installation method packages the New Relic agent with your application so that it is available to the Azure Web App Host.

Our .NET agent supports .NET Core Linux and Windows applications on Azure App Services. The installation process for Azure App Services differs from the .NET agent install procedures for Linux and Windows.

To install the .NET agent on an Azure Web App using NuGet:

  1. Install the NewRelic.Agent NuGet package.

  2. Modify the log node by adding a directory attribute to your newrelic.config file (Note: If Visual Studio prevents you from editing the newrelic.config file that was added to your project by NuGet then you will need to make a local copy of this in your application):

  3. Publish your application.

  4. In the Azure portal, open the web app you want to monitor, then select Settings > Configuration.

  5. From Configuration, select + New application setting and add these key/value pairs.

Important

These examples all assume that your Azure Web App uses a D: file system root. If your Azure Web uses a C: root, you need to use the correct drive letter when configuring these paths.

  1. In the Azure portal, add New Relic app settings to your Azure App Service.
  2. Restart your web app.

Add New Relic app settings to Azure App Services

To add your app settings:

  1. Make sure you have your before adding the New Relic .NET agent's app settings.

  2. In the Azure portal, search for and open App Services to go to the web app you want to monitor. Next, select Configuration > Application settings.

  3. From Application settings, select + New application setting and add these key/value pairs:

    Key

    Value

    NEW_RELIC_LICENSE_KEY

    YOUR_LICENSE_KEY

    NEW_RELIC_APP_NAME

    YOUR_APP_NAME

    If you need to use a previous .NET agent version, use this key/value pair:

    Key

    Value

    NEWRELIC_AGENT_VERSION_OVERRIDE

    DESIRED_AGENT_VERSION_NUMBER

  4. Save and restart your web app.

Setting the and app name with Application settings will override the newrelic.config.

To verify your app's environment variables in your app's Kudu diagnostic console, go to Environment > Environment variables.

For example:

https://myappname.scm.azurewebsites.net/Env.cshtml#envVariables

View your app's performance

Your application must receive traffic in order for you to view its performance in New Relic. You may need to wait a few minutes for data to start appearing. If no data appears, see the troubleshooting procedures for Azure Web Apps. To view your app's performance in New Relic: Go to one.newrelic.com > All capabilities > APM & services > (select an app). The APM Summary page automatically appears.

Did this doc help with your installation?

Troubleshooting

If no data appears after installing the agent, generating traffic for your app, and waiting a few minutes, try these troubleshooting tips:

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.