Understanding Azure function Scheduled Expression and CRON expressions
The following example is a timer triggered function which adds values to a queue.
A timed azure function requires a TimerTrigger attribute on the the parameter TimerInfo which gives the function the information on when to run. The attribute TimerTrigger takes a parameter scheduledExpression. This expression is a Cron expression.
When first creating timed azure function using azure or visual studio function templates by default it is set to run every 5 minutes.
A timed azure function requires a TimerTrigger attribute on the the parameter TimerInfo which gives the function the information on when to run. The attribute TimerTrigger takes a parameter scheduledExpression. This expression is a Cron expression.
When first creating timed azure function using azure or visual studio function templates by default it is set to run every 5 minutes.
- The * character refers to any value.
- The / character shows step values, for instance in the above example will run on a schedule of minutes that is divisible exactly by 5 including 0, which is 5,10,15,20,25,30,35,40,45,50,55,00.
The examples above will also run on a interval of minutes. Both expressions are the same and will run every 20 minutes and only weekdays.
- The , character is a value separator which could be used for weekday e.g. MON,WED,FRI or 1,4(Monday and Thursday)
- The - character enables the use of a range of values in this case day of week 1-5 which is all weekdays only.