Azure Cloud Services

If your application runs on Microsoft's Azure Cloud platform, follow this procedure to install New Relic's .NET agent. If your application runs on the Azure App Services platform, see Azure App Services.

Before installing the NuGet package into a multi-project Visual Studio solution, make sure you have selected the correct project for your New Relic .NET application (for example, a specific website project).

Special pricing

New Relic has partnered with Microsoft to provide discounted pricing when you sign up through the Windows Azure Store. For specific pricing details, see New Relic in the Azure Store.

If you install the .NET agent for your Windows Azure app directly from New Relic's website rather than through the Windows Azure Store, the special pricing offer does not apply.

 

[video link] For an overview of installing the .NET agent in Azure Cloud Services, watch this video (approximately 2.5 minutes). View more videos and tutorials at learn.newrelic.com.

Quick install: Azure Cloud Services

If you are familar with New Relic, Azure, and NuGet, this summarizes how to add New Relic to your Azure-deployed application. For more detailed instructions, see Installing New Relic on Web and Worker Roles.

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

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

  1. Install the NewRelicWindowsAzure NuGet package in your app using this command:
    Install-Package NewRelicWindowsAzure
  2. Follow the prompts to enter your New Relic license key and application name.
  3. Deploy your application to Azure.

Install New Relic on Web and Worker Roles

Users located in the United States have access to the Windows Azure Store. To sign up for New Relic directly from the Windows Azure Store:

  1. Sign up through the Azure Store.
  2. Install the NuGet package.
  3. Wait a few minutes, then check your app's performance in New Relic.

Your app must receive traffic in order to view its performance in New Relic. You may need to wait a few minutes for data to start appearing.

Sign up through the Azure Store (USA users only)

To sign up, go to the New Relic in the Azure Store. When you sign up, you will be prompted to enter a name for the New Relic service. This name must be unique in your list of subscribed Windows Azure Store items.

  1. Sign in to the Windows Azure Management Portal, and select New.
  2. Select Store.
  3. In the Choose a service dialog, select New Relic, and select Next.
  4. In the Personalize Service dialog, select the New Relic plan that you want.
  5. Enter a promotion code, if applicable.
  6. Enter a name for how the New Relic service will appear in your Windows Azure settings, or use the default value NewRelic.
  7. Choose a value for the region (for example, West US), and select Next.
  8. In the Review Purchase dialog, review the plan and pricing information, and review the legal terms. If you agree to the terms, select Purchase.

After you select Purchase, your New Relic account will begin the creation process. You can monitor the status in the Windows Azure Management Portal.

Install the NuGet package

When you install the NuGet package, you will need your New Relic license key. To retrieve it: From the New Relic section of the Windows Azure management portal, select Connection Info, then copy the license key that appears.

  1. Open your Visual Studio solution, or create a new one by selecting File > New > Project. For multi-project solutions, make sure you have selected the correct project (for example, a specific website project).

  2. If you don't already have a Windows Azure Cloud Service Project in your solution, add one by right-clicking your app in the Solution Explorer and selecting Add Windows Azure Cloud Service Project.

  3. Open the Package Manager console by selecting Tools > Library Package Manager > Package Manager Console. Set your project as the Default Project at the top of the Package Manager Console window.

  4. From the Package Manager command prompt, type Install-Package NewRelicWindowsAzure and press Enter.

  5. At the license key prompt, type the license key you received from the Windows Azure Store.

  6. Optional: At the application name prompt, type your app's name as you want it to appear in the New Relic UI. Or, use your solution name as the default.

  7. From the Solution Explorer, right-click your Windows Azure Cloud Service Project, and select Publish.

  8. If this is your first time deploying this app to Azure, enter your Azure credentials.

  9. If instrumenting a worker role: The .NET agent automatically instruments external calls and database calls, but does not instrument any default methods for transactions in Worker Roles. Follow the instructions in Instrument a .NET Worker Role.

Check Web/Worker role's location

You may experience problems if your Web/Worker role is located within a Solutions folder in the Visual Studio Project.

The current Nuget installer is not able to locate the necessary Service files to update them if they are nested within a Solution folder. This will cause issues with the agent setup, which will in turn prevent the agent from reporting metrics on your Cloud Service.

New Relic recommends that you place the Web/Worker role at the root of the solution before installing the Nuget package. Once the agent is installed, the Cloud role can be moved back into the Solution folder.

Check 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 view your application's performance in New Relic:

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

Your app's APM Overview page automatically appears.

If no data appears, see the Azure Cloud Services troubleshooting procedures.

Create custom config file

You can create a custom configuration file in Visual Studio. This allows you to make changes to newrelic.config inside Visual Studio, without having to remote into your Azure Role instance every time you make a change. Whenever you publish your app, the config file in Visual Studio is automatically uploaded to the remote host.

  1. In Visual Studio, select the Solution Explorer. Then open NewRelicAgent_x64_XYZ.msi.
  2. Follow the steps and install the agent locally. (The choices you make in the install wizard do not matter, since installing locally will not affect your Azure development environment.)
  3. Import newrelic.config into your project: In Solution Explorer > Cloud Project, right-click the Web Role and select Add > Existing Item. Navigate to C:\ProgramData\New Relic\.NET Agent and select newrelic.config.
  4. From C:\ProgramData\New Relic\.NET Agent, edit newrelic.cmd.
  5. In the :INSTALL_NEWRELIC_AGENT section, find this statement:

    IF $ERRORLEVEL% EQU 0 (
  6. Add the following code as another statement inside the IF block, then save the file:

    copy /Y "%RoleRoot%\approot\newrelic.config" "%NR_HOME%" >> %RoleRoot%\nr.log

You can now edit the newrelic.config hosted in Visual Studio. Whenever you publish your app, the copy command will upload the config file to the remote host.

For more help

Additional documentation resources include:

Join the discussion about .NET monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

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