Friday, October 21, 2016

Cron Scheduling and Nano Services in Open Source Azure Functions

There are many ways to schedule jobs in Azure.  An interesting and fairly simple one available is to use Azure Functions, a lil' brudder of WebJobs.  For up to 1 million 1 second functions, there is no cost.  You can schedule a job function in Bash, C#, F#, NodeJs, Python, Java, etc.

Example json for a function. for those who have not mastered the art of reading job schedules in Cron, this will run at 3:25am UTC every Monday - Friday.

In this case, your "crontab" or cron table part of the JSON formatted job definition.

  "bindings": [
      "schedule": "25 3 * * 1-5",
      "name": "nightlyReports",
      "type": "timerTrigger",
      "direction": "in"
  "disabled": false

This is the function example to log the timer event.

public static void Run(TimerInfo myTimer, TraceWriter log)
    log.Info($"C# Timer trigger function executed at: {DateTime.Now}");    

If your job is to execute a SQL stored procedure such as an SSIS proc to kick off an ETL package, or archive / groom data.

Another example is an event-based trigger coming from an Event Hub, or Blob Storage based trigger coming from a blob, table, queue, or file drop.

Once a function has been created, you can test or run the function with cURL by copying the Function Url.

The code is in GitHub, packaged as the Azure Webjobs SDK Script.

Announced at Build 2016, Some facts on Azure Functions from MSFT Playground

Do you use Azure Web Jobs or the new Functions Preview?

Functions Reference

Functions with Logic Apps

Continuous Deployment

No comments: