Deploying apps on Windows Azure? Be sure to add New Relic monitoring. Check out our simple setup guide

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 and above.

To install the agent on an Azure .NET 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 Copy always.

dot_net_agent_copy_always_normalAdd a text file to the project named startup.cmd and set its Copy to Output Directory property to Copy always. Save the file with Unicode (UTF8 without signature) codepage 65001 encoding.

From Microsoft:

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 startup.cmd:

NewRelicAgent_.msi /quiet NR_LICENSE_KEY=
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v COR_ENABLE_PROFILING /t REG_SZ /d 1
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="">
    <WebRole name="WebRole1">
            <Task commandLine="startup.cmd" executionContext="elevated" taskType="simple"/>
            <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 NewRelic.AppName:

    <add key="NewRelic.AppName" value="StoreFront"/>

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.'

View posts by .

Interested in writing for New Relic Blog? Send us a pitch!