This blog post will teach you on creating Scheduled Azure WebJobs. The WebJobs are a method to run background tasks in Azure just like Windows Services. These Web Jobs are tied to Azure App Services and can be Continuous or Triggered.

The Continuous type will trigger as soon as it is deployed and can be debugged. Usually the developer controls it’s execution in an endless loop. In adition to that, it runs on all instances that your web app runs. As a draw back, it must have the feature AlwaysOn enabled. Basically, if you have a cheap subscription, you won’t be able to use that.

The Triggered option needs to be triggered manually or scheduled. This execution will only run on one instance of your application. Furthermore, it doesn’t allow remote debugging.

The following file types are supported to be a Web Job, according to Microsoft documentation:

  • .cmd, .bat, .exe (using Windows cmd)
  • .ps1 (using PowerShell)
  • .sh (using Bash)
  • .php (using PHP)
  • .py (using Python)
  • .js (using Node.js)
  • .jar (using Java)

Fortunatelly, what you want is to run a WebJob from time to time using the Triggered type! You will only need to understand CRON expressions to specify the schedule pattern. Please, check this FreeFormatter tool to configure your CRON expression.

According to Oracle, CRON expressions are strings consisting of six or seven subexpressions (fields) that describe individual details of the schedule.

Continue reading