Schedule an Azure Function using local time

less than 1 minute read

I have an Azure function that needs to run at 07:00 in the morning and 15:00 in the afternoon every day - Norwegian time.

By default, the CRON expression used to schedule a time-triggered Azure function uses UTC. As Norway is UTC+1 I had set the CRON expression to:

0 0 5,13 * * *

This worked fine all the way through the winter, but when daylight savings kicked in (and Norway moves to UTC+2) the trigger was one hour off.

Note: Azure Functions use a 6 value CRON expression on the form {second} {minute} {hour} {day} {month} {day-of-week}, not the regular 5-value CRONs without seconds.

Luckily, the CRON expression respects the time zone of the web app if specified using the WEBSITE_TIME_ZONE key:

Website time zone setting

Valid values for time zones can be found in this list.

After adding the setting in the Azure Portal I just needed to change my CRON expression to Norwegian hours; 0 0 7,15 * * *, and everything worked fine.

Leave a Comment