A quick getting started guide for Azure Timer functions. Timer triggers give us alot more options to automate things. With Azure timer functions we don't have to take care of the timer Azure handles that. We can focus on the code and what our function should do.

CRON Expressions

Azure timer functions use a CRON expression for the schedule. CRON Expressions can be a bit confusing at first but with some time they make sense and really easy to configure and use.

A CRON Expression contains six fields.

{second} {minute} {hour} {day} {month} {day-of-week}

Each field is separated by a space. The value of the fields can vary and this is where I think alot of people get lost.

Examples of values:

A specific value:

"0 */5 * * * *"  - Every 5 Minutes.

"0 0 */6 * * *" - Once every 6 hours.

Note the */X this sets the trigger to every X.

"0 0 * * * *" - At the top of every hour.

"0 30 8 * * *" - At 8:30 AM every day

"0 30 11 * * 1-5" - At 11:30 AM every week day. (Monday - Friday)

To specify months or days you can use numeric values, names, or abbreviations of names:

  • For days, the numeric values are 0 to 6 where 0 starts with Sunday.
  • Names are in English. For example: Monday, January.
  • Names are case-insensitive.
  • Names can be abbreviated. Three letters is the recommended abbreviation length.  For example: Mon, Jan.

The default time zone used with the CRON expressions is Coordinated Universal Time (UTC). Azure Timer functions can run in other time zones to change the time zone you need to add a setting in the Function.json

WEBSITE_TIME_ZONE - "Eastern Standard Time"

For a full list of Azure Time zones see here

Creating a function

In our Azure Portal Go to our functions. If you haven't checked them out, see my getting started guide. For all my Azure function posts.

Create a new Function, on the wizard select the "Timer Trigger" function.

Create an Azure Timer Function

We then need to name our new function.

We can also set a schedule by default. The Timer function I just created uses a every 5 minutes expression: "0 */5 * * * *"

Create our new Timer function. 

Now that we have created a function. The default code will write to the log every 5 minutes.

Default Function will write to it's log.

So that's it, we can now code up our function as we want and Automate all the things.

To change the timer on the function just head to the function.json file

  "bindings": [
      "name": "myTimer",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 */5 * * * *"
  "disabled": false

You can see the schedule settings here. Changing it and resaving it will update the triggers timer.