Overview

If you’re an avid user of the Microsoft Azure cloud, you might have come across CRON expressions for defining schedules.

The CRON expression format originates from Unix-based systems, where it has been used for quite some time. While it is a powerful syntax for expressing schedules, it can sometimes be a bit confusing.

This article will provide you with a quick cheat sheet for using CRON expressions in Azure.

Azure Logo

Format

A CRON expression is simply a string consisting of six fields that each define a specific unit of time.

They are written in the following format:

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

Acceptable Values

The following values are allowed within each date/time unit placeholder.

FieldAllowed ValuesDescription
{second}0-59
*
Trigger every {second} second(s)
{minute}0-59
*
Trigger every {minute} minute(s)
{hour}0-23
*
Trigger every {hour} hour(s)
{day}1-31
*
Trigger every {day} day(s) of month
{month}1-12
*
Trigger every {month} month(s)
{day of week}0-6
MON-SUN
*
Trigger on specific {day of week}

Special Characters

Additionally you can also use the following special characters to build more advanced expressions:

Special CharacterDescription
*Trigger on tick of every time unit
E.g. ‘*’ in {day} means every day of the month
,List separator
E.g. ‘1,2’ in {month} means every first and second month of the year
Specifies a range
E.g. ‘5-7’ in {day} means fifth, sixth and seventh of the month
/Defines an increment
E.g. ‘*/10’ in {minute} means every ten minutes.

Examples

ExpressionDescription
0 * * * * *Executes every minute
0 0 * * * *Executes every hour
0 0 0 * * *Executes every day
0 0 0 0 * *Executes every month
0 0 0 1 1 *Executes on first day of Jan
each year
30 20 * * SATExecutes at 08:30pm every Saturday
30 20 * * 6Executes at 08:30pm every Saturday
0 */5 * * * *Executes every five minutes
0 0 8-10/1 * * *Executes every hour between
8am and 10am

Still Stuck?

If you still need a bit more help then why not try this handy CRON to English Translator. It’s great for sanity checking your CRON expressions. Note: I have no affiliation with the developer of this utility so don’t blame me 🙂

https://bradymholt.github.io/cron-expression-descriptor/

Cron Expression Translator Screenshot

Additional Resources

You can find more information about CRON expressions at the below links:

Final Thoughts

CRON expressions are very powerful however can sometimes be a bit confusing. I hope this article has helped you better understand how to use them.

If you have any thoughts or suggestions, feel free to share them in the comments below.

Shane Bartholomeusz