An Inside Look at Microsoft Azure WebJobs

Scheduled tasks, batches, and small processing jobs have historically been convoluted to build, run, and monitor. Microsoft Azure WebJobs tries to drastically simplify this for developers: They are simply background jobs that can process continuously or on a schedule.

Free and simple

Free and incredibly simple to create and use, Azure WebJobs are one of the .NET agent team’s favorite bits of technology on the Microsoft Azure stack. For developers, some of the most delightful aspects of WebJobs are the dashboards and invocation features available right out of the box!

The WebJobs dashboards can be accessed through the kudu site associated with your WebJobs host site:


We wanted to monitor our WebJobs to better understand what they were doing. We wanted to find out, for example, if there were any issues or errors and learn what things might need refactoring to make processing our queues more efficient.

So we instrumented the things that were important to us using the New Relic .NET agent. (See the supporting code on GitHub.)

How to do what we did

1. Add the New Relic Site Extension to your host site: See the docs under “Install using the Site Extension from the SCM site.”



2. Get your license key (browse to[accountId] after logging in—the license key will appear on the right side).

screen account settings license key


3. In the app.config of the WebJob add the following appsetting:

    <add key="NewRelic.AppName" value="[replace_with_the_name_you_want_reported_to_new_relic]" /> 
    <add key="NewRelic.AgentEnabled" value="true" /> 
    <add key="NewRelic.LicenseKey" value="[replace_with_your_key]" /> 

4. Add some instrumentation (for example, to help the agent look for what you feel is important to monitor).

5. In the WebJob, add a folder and file: newrelic\extensions\[someuniquename].xml

6. Make sure its Build action is Content.

7. In the file, add your instrumentation.

For instance, let’s say your function.cs has

namespace WebJobs.Journals
  public class Functions
     public static void JournalOperations(parms...)
        new JobRunHandler<JobMessage>(parms...)                 

The content in the XML instrumentation file will look like this:

<?xml version="1.0" encoding="utf-8"?> 
<extension xmlns="urn:newrelic-extension">   
    <tracerFactory name="NewRelic.Agent.Core.Tracer.Factories.BackgroundThreadTracerFactory">
      <match assemblyName="WebJobs.Journals" className="WebJobs.Journals.Functions">
        <exactMethodMatcher methodName="JournalOperations" />

8. Finally, restart your host site

We have now given ourselves X-ray vision into our WebJobs! This allows developers to better understand and tune their applications while providing the visibility to operations to make sure our WebJobs are healthy and scaling appropriately. You can get more information on how to do this for yourself and try it today by heading out to GitHub and getting the code.

Nick Floyd is a lead software engineer at New Relic. He works on the .NET Agent, Nuget packages, Azure solutions, and cloud-based services. He and his seven kids are often found contributing to open source, soldering boards, and building backyard ballistics all in the name of "nerd life." Author of Nerd Life Balance. View posts by .

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