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).
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.
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.
- Install the NewRelicWindowsAzure NuGet package in your app using this command:
- Follow the prompts to enter your New Relic license key and application name.
- 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:
- Sign up through the Azure Store.
- Install the NuGet package.
- 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.
- Sign in to the Windows Azure Management Portal, and select New.
- Select Store.
- In the Choose a service dialog, select New Relic, and select Next.
- In the Personalize Service dialog, select the New Relic plan that you want.
- Enter a promotion code, if applicable.
- Enter a name for how the New Relic service will appear in your Windows Azure settings, or use the default value NewRelic.
- Choose a value for the region (for example, West US), and select Next.
- 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.
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 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.
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.
From the Package Manager command prompt, type
Install-Package NewRelicWindowsAzureand press Enter.
At the license key prompt, type the license key you received from the Windows Azure Store.
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.
From the Solution Explorer, right-click your Windows Azure Cloud Service Project, and select Publish.
If this is your first time deploying this app to Azure, enter your Azure credentials.
- 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:
- From the Azure portal, select Manage.
- Sign in with your New Relic account email and password.
- 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.
- In Visual Studio, select the Solution Explorer. Then open NewRelicAgent_x64_XYZ.msi.
- 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.)
newrelic.configinto your project: In Solution Explorer > Cloud Project, right-click the Web Role and select Add > Existing Item. Navigate to
C:\ProgramData\New Relic\.NET Agentand select
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 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:
- Installing the .NET agent on Azure (overview and special pricing for using New Relic's .NET agent with Windows Azure)
- Azure Web Apps (New Relic's procedures for Azure Web Apps)
- Azure Preview Portal (Installing and using New Relic .NET agent on new Azure Portal [currently in Preview])
- Azure Troubleshooting (tips and procedures specific to New Relic's .NET agent and Microsoft Azure products).