This document explains how to install APM's .NET agent on Microsoft's Azure Cloud Services platform. This is not the same as installing the Infrastructure integrations for Microsoft Azure. To make sure you are using the most relevant instructions, first see the .NET agent install overview.
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).
If Service files are nested within a Solution folder, the NuGet installer cannot locate or update the necessary files. This will cause issues with the .NET agent setup, which will in turn prevent the agent from reporting metrics on your Cloud Service.
Recommendation: Place the
Worker role at the root of the solution before installing the NuGet package. Once the New Relic .NET agent is installed, you can move the Cloud role back into the Solution folder.
The NuGet packages in this procedure support only the old
packages.config. They do not support the new
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 website project) before installing the NuGet package.
- 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).
- If you do not already have an 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.
- Open the Package Manager console by selecting Tools > Library Package Manager > Package Manager Console. Set your project as the default project.
- From the Package Manager command prompt, type
Install-Package NewRelicWindowsAzureand press Enter.
- Follow the prompts to enter your New Relic license key and your application name as you want it to appear in the New Relic UI. Or, use your solution name as the default app name.
- From the Solution Explorer, right-click your Azure Cloud Service project, and select Publish.
- If this is your first time deploying this app to Azure, enter your Azure credentials.
- If applicable, instrument methods for
Worker role is a non-web process run as an Azure Cloud Service. To instrument a
Worker role, you must create custom transactions.
The .NET agent automatically instruments external calls and database calls, but it does not instrument default methods for transactions. Creating custom transactions solves this. After the
Worker role starts up and the method executes, transaction data will appear in the APM Summary and Transactions pages under the Non-web category.
The NuGet installer automatically adds the
NewRelic.AppName parameter to the application config. This appears as
The .NET agent also automatically instruments
WaWorkerHost.exe. This is the name of the actual
Worker role process.
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.
The choices you make with the installation wizard do not matter. Installing locally does not affect your Azure development environment.
In Visual Studio, select the Solution Explorer, then open
Follow the steps to install the agent locally.
newrelic.configinto your project: In Solution Explorer > Cloud Project, right-click the Web Role, then select Add > Existing Item. Navigate to C:\ProgramData\New Relic\.NET Agent and select
From C:\ProgramData\New Relic\.NET Agent, edit
:INSTALL_NEWRELIC_AGENTsection, find this statement:IF $ERRORLEVEL% EQU 0 (
Add the following code as another statement inside the
IFblock, 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.
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 Cloud Services.
To view your app's performance in APM: Go to one.newrelic.com > APM > (select an app). The APM Summary page automatically appears. You can also view detailed information about errors, database and instance performance issues, and more.
If you created your New Relic app prior to October 2017, you can use the Azure Portal to select the New Relic account blade. You will be automatically logged in with SAML Single Sign-on (SSO) to APM. You can also view your application's error rate and throughput data in the Azure Portal by going to New Relic Accounts > choose your application.