Azure WebJobs made simple

The last couple of weeks I have been playing around with Office Mix. For those who don’t know Office Mix, Office Mix is a add-in for PowerPoint that is in preview to easily create and share interactive online videos.

With this add-in it is very easy to create a Video of your presentations and also insert screen recordings. For a first pilot I created a PowerPoint presentation called: “Azure WebJobs made simple”.

With Azure WebJobs you have options to run different background tasks. The WebJobs will be hosted on the same virtual machine as you Azure Web App.

The following file types can be used as a Azure WebJob:

  • .exe – .NET assemblies
  • .cmd, .bat, .exe (using windows cmd)
  • .sh (using bash)
  • .php (using php)
  • .py (using python)
  • .js (using node)

For this blog post and for the video I created a simple Console Application that executes the following code.

class Program {
    static void Main(string[] args) {

        Console.WriteLine("Starting Web Job Application");

        Stopwatch timer = new Stopwatch();
        timer.Start();

        Console.WriteLine(DateTime.Now);

        for (int i = 0; i < 15; i++) {
            WriteInfo(i);
            Thread.Sleep(500);
        }

        timer.Stop();
        Console.WriteLine("Web Job Procession took: " + timer.Elapsed.Seconds + " seconds");

        Console.WriteLine("Finished Web Job Application");
    }

    static void WriteInfo(int number) {
        Console.WriteLine("Working on item: " + number);
    }
}

With the use of “Console.WriteLine” you can post message on the WebJob console. Within Azure there are two types of WebJobs.

  • Continuous: Actions are taken when for example a item is added in a Queue.
  • On demand: Actions run on demand.

Besides these two option you are also able to schedule WebJobs. This can be done by using the old portal or by publishing the WebJob with Visual Studio.

The following actions are displayed in the video:

  • What can run on Azure
  • Create a Azure Web App
  • Upload the Azure Web Job
  • The Web Job Management Portal
  • Schedule a Azure WebJob
  • Deploy via Visual Studio

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.