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 1.1.0.32 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
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:

azure_project_normal

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 NewRelic.AppName:

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

marketing@newrelic.com'

View posts by .

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