Azure: Schedule Azure Function in local time zone

Recently, we were working on Timer triggered Azure functions. One of them was required to run at 2AM Australia time(UTC+10).

Azure Function uses 6 value CRON expression {second} {minute} {hour} {day} {month} {day-of-week}, not the regular one with 5 values.

So, we set the azure function timer with CRON expression “0 0 2 * * *”. By default, Azure function uses UTC for which the function started running at 12PM Australia time.

To fix this, we have 2 options:

  1. Manipulate the CRON expression so that it runs at 2AM Australia time i.e. “0 0 16 * * *”. This comes with an issue of further manipulating the CRON expression when the daylight savings kick off.
  2. Use app setting named WEBSITE_TIME_ZONE with the time zone as shown below:

Time zone value that we need to put can be found here https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc749073(v=ws.10)?redirectedfrom=MSDN.

Hope it helps !!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.