Azure Web Sites

If your app runs on Microsoft's Azure Web Sites platform, follow this procedure to install New Relic's .NET agent.

Known issues

Here is a summary of known issues you might experience when installing the .NET agent on a Windows Azure Web Site.

Web Site issues Comments
Log file locking

On Web Sites when connecting via FTP, users can see that there is a NewRelic.Profiler.####.log file in LogFiles\NewRelic\. However, when attempting to do anything with that file, an error message states the user cannot do anything with the file until they stop or restart the process.

Workaround: You can restart your Web Site to release the file and create a new profile log.

Profiler dll locking during deploy

When deploying a new version of the New Relic agent (NewRelic.Profiler.dll), an error message states that the user cannot do anything until they stop or restart the process. The expected behavior is that the process stops, then the assets get overwritten during a deployment with the ones New Relic packs up in the site root (located at: C:\Home\site\wwwroot\newrelic).

Workaround: You can stop your Web Site to release the file and allow the update to take place. Once the deploy is complete you can restart the instance. This will only happen if you are attempting to deploy a new version (over an existing one) of the .NET agent to an Azure Web Site.

Selecting the NuGet package

As part of the installation process, you must select the correct NewRelic.Azure.WebSites NuGet package for your site (32-bit/x86 or 64-bit). To verify which package you need:

  1. Sign in to manage.windowsazure.com, and navigate to your Web Site.
  2. Select Configure > Platform, and verify the NuGet package version for your site.

Quick install: Azure Web Sites

If you are familiar with New Relic, Azure, and NuGet, this summarizes how to add New Relic to your Azure-deployed application. For multi-project solutions, make sure you have selected the correct project (for example, a specific website project) before installing the NuGet package.

Note: This procedure requires your New Relic license key. To retrieve it: From the New Relic section of the Windows Azure management portal, click Connection Info, and then copy the license key that appears.

  1. Install the NewRelic.Azure.WebSites NuGet package (for example, 32-bit/x86) in your app using this command:
    Install-Package NewRelic.Azure.WebSites

    If you are unable to use the NuGet package or are using Web Matrix, see Manual installation.
  2. Follow the prompts to enter your New Relic license key and application name.
  3. Sign in to manage.windowsazure.com, and navigate to your Web Site.
  4. From your Azure Web Site, select Configure > Developer analytics, and for Performance Monitoring, select Custom.
  5. For Provider, select New Relic, enter your New Relic license key, and then select Save.
  6. To ensure that your configuration key values (automatically added in the App settings) can be picked up by your Azure Web Site, either stop and then start your site, or restart it and then wait for the Azure restart delay (usually 20-30 seconds).
  7. Deploy your application to Azure by using Source Control, Web Deploy, Web Matrix, or FTP.
  8. Make sure user traffic is going to your site, so that you can view metrics in your New Relic Applications Overview dashboard.

Azure Web Sites Custom install
Here is an example of the Developer analytics section when for standard installations where you select Custom to identify the Provider (New Relic) and your license key.

New Relic Add-on

If you signed up for New Relic through the Azure Management Portal, you can click the New Relic Add-On that you created, and then click Manage at the bottom of the portal to access your New Relic account.

When installing New Relic's .NET agent as an Add-on, the Configure steps are slightly different:

  1. From your Azure Web Site, select Configure > Developer analytics, and for Performance Monitoring, select Add-on.
  2. For Provider, select New Relic, and then select Save.

Azure Web Sites Add-on install
Here is an example of the Developer analytics section when using the New Relic Add-on to identify the Provider (New Relic).

Checking 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. To check out your application's performance in your New Relic dashboard:

  1. From the Azure portal, click Manage.
  2. Sign in with your New Relic account email and password.
  3. From the New Relic menu bar, select Applications > (selected app).

Your app's Monitoring > Overview dashboard automatically appears.

Using New Relic

New Relic Applications Overview dashboard
Applications > (selected app) > Monitoring > Overview: After you select an application from the list on your New Relic Applications menu, the Overview dashboard shows current information about your app's server requests, browser page load time, or other transaction information as applicable.

After you select your app from the list on the Applications menu, the Overview dashboard shows current information about your app's server requests, browser page load time, or other transaction information as applicable. For more information about using New Relic (in addition to the standard New Relic user interface and dashboard drill-down functions), see Applications Overview dashboard.

Manual installation

Typically you should be able to use the NewRelic.Azure.WebSites NuGet package (for example, 32-bit/x86). However, there may be times when you cannot execute a package on your Azure Web Site before you deploy it.

Also, the current NuGet package uses some Powershell to prompt for your license key and application name. If you install the NuGet package using Web Matrix, those commands are not allowed to be executed, so you must enter the values manually.

  1. From New Relic's GitHub repository, add the newrelic folder containing the .NET agent to the root of your Azure Web Site (either on Azure via FTP or before building and deploying to Azure Web Sites).
  2. In the NewRelic.Config file (in the newrelic folder in the root of your site), replace the text REPLACE_WITH_LICENSE_KEY with your license key:
    <service licenseKey="REPLACE_WITH_LICENSE_KEY" ssl="true">
  3. Sign in to manage.windowsazure.com, and navigate to your Web Site.
  4. If applicable: From your Azure Web Site, select Configure, and add the configuration key values as App settings.
  5. To ensure that your App settings can be picked up by your Azure Web Site, either stop and then start your site, or restart it and then wait for the Azure restart delay (usually 20-30 seconds).
  6. Deploy your application to Azure by using Source Control, Web Deploy, Web Matrix, or FTP.
  7. Make sure user traffic is going to your site, so that you can view metrics in your New Relic Applications Overview dashboard.

Optional: You can replace the element <application> in the newrelic.config file with a more meaningful application name:

<application><name>My Application</name></application>

Otherwise the application name will default to the name of your Windows Azure Web Site as defined in the Azure portal.

Configuration key values

The Azure Web Site installation process automatically adds these configuration key values in the App settings.

Key Value
COR_ENABLE_PROFILING 1
COR_PROFILER {71DA0A04-7777-4EC6-9643-7D28B46A8A41}
COR_PROFILER_PATH C:\Home\site\wwwroot\newrelic\NewRelic.Profiler.dll
NEWRELIC_HOME C:\Home\site\wwwroot\newrelic

Optionally you can set these variables by using one of the two following methods:

Cross-Platform CLI tool

To use the Cross-Platform CLI tool:

  1. Download and install the Cross-Platform CLI tool.
  2. Add your Publish Profile using the SDK.
  3. Sign in to manage.windowsazure.com > Web Sites > (Web Site name) > Download the publish profile.
  4. Execute the following in a PowerShell console:
  5. PS> azure account download "Subscription Name"
    PS> azure account import "PathToPublishSettingsFile"
  6. Execute the PowerShell script below, replacing "MyWebSiteName" with your website's name.
$appName = "MyWebSiteName"
azure site config add "COR_ENABLE_PROFILING=1" $appName
azure site config add "COR_PROFILER={71DA0A04-7777-4EC6-9643-7D28B46A8A41}" $appName
azure site config add "COR_PROFILER_PATH=C:\Home\site\wwwroot\newrelic\NewRelic.Profiler.dll" $appName
azure site config add "NEWRELIC_HOME=C:\Home\site\wwwroot\newrelic" $appName

Azure PowerShell SDK

To use the Azure PowerShell SDK:

  1. Download and install the Azure PowerShell SDK.
  2. Add your Publish Profile using the SDK.
  3. Sign in to manage.windowsazure.com > Web Sites > (Web Site name) > Download the publish profile.
  4. Execute the following in a PowerShell console:
  5. PS> Import-AzurePublishSettingsFile "PathToPublishSettingsFile"
  6. Execute the PowerShell script below, replacing "MyWebSiteName" with your website's name.
$appName = "MyWebSiteName"

$appSettings = @{ `
    "COR_ENABLE_PROFILING" = "1"; `
    "COR_PROFILER" = "{71DA0A04-7777-4EC6-9643-7D28B46A8A41}"; `
    "COR_PROFILER_PATH" = "C:\Home\site\wwwroot\newrelic\NewRelic.Profiler.dll"; `
    "NEWRELIC_HOME" = "C:\Home\site\wwwroot\newrelic" `
}

Set-AzureWebsite -Name $appName -AppSettings $appSettings

For more help

Additional documentation resources include:

  • Installing the .NET agent on Azure (overview and special pricing for using New Relic's .NET agent with Windows Azure)
  • Azure Cloud Services (New Relic's installation procedures for Azure Cloud Services, including Web and Worker Roles)
  • Apdex (overview of how Apdex measures end users' satisfaction with your application)
  • Real user monitoring (overview of how RUM details the time it takes for your users' browsers to load your site, where they come from, and what browsers they use)
  • Finding help (resources available through New Relic's online Help Center)

If you need additional help, get support at support.newrelic.com.