Direct from our support site, here are some instructions for getting New Relic up and running on the Windows Azure cloud platform. It’s fun and easy! Well, we thought it was fun. Please note that these instructions apply to the New Relic .NET agent versions 22.214.171.124 and above.
To install the agent on an Azure .NET application:
- Add the agent installer to your Azure deployment package
- Create a script to install the agent and restart IIS
- Edit service definition of each web or worker role you wish to instrument to run the startup script
- Redeploy your application
The steps are based on this Microsoft support article
Start by downloading the latest version of the .NET agent from the RPM site and copying it into the root directory of each worker role in your project. Right-click the installer within the project, click Properties, and set
Copy to Output Directory to
Text files that are created in Visual Studio are saved by default in a format that includes a byte order mark it impossible to execute them as batch files. If you use Visual Studio to create your command file, use the advanced options menu of the
Save File <file name> As on the
File menu to save the file in a format that can be run on Windows Azure. The advanced options menu menu is access by clicking the the small rectangle to the right of the
Save button and then click
Save with Encoding to open the
Advanced Save Options dialog box. Use this dialog box to specify the encoding for the file.
Unicode (UTF8 without signature) codepage 65001 works for saving command files that run properly.
Paste this into
NewRelicAgent_.msi /quiet NR_LICENSE_KEY= REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v COR_ENABLE_PROFILING /t REG_SZ /d 1 iisreset NET START "World Wide Web Publishing Service"
Update the name of the msi installer to reflect the exact file name of the installer you are using. Your project should look similar to this:
Edit the Service Definition of your application and add a startup element to each of your web roles:
<ServiceDefinition name="WindowsAzureTest2" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> <WebRole name="WebRole1"> <Startup> <Task commandLine="startup.cmd" executionContext="elevated" taskType="simple"/> </Startup> <Sites> <Site name="Web"> ...
If you want to name your web roles so that they appear as different applications in New Relic, edit
Web.Config for the role and add an application setting named
</connectionStrings> <appSettings> <add key="NewRelic.AppName" value="StoreFront"/> </appSettings>
That’s it! Build and deploy your application to Azure. After the host for each web role is created and initialized, the startup script will install the New Relic .NET Agent and restart IIS. After the deployment is complete send a few requests to your application. Data should appear within the RPM UI within 2-3 minutes.
If data does not appear in RPM as expected, use the Azure Remote Desktop services to connect to one of your Azure instances and inspect the agent installation, the agent log files and the application events in the event viewer.
The New Relic .NET agent currently only supports web roles. If you have an application with a worker role that you would like to instrument, please contact New Relic support.