Bi Monthly Azure Function not running : "15 0 1,15 * *"

Dafydd Owen 96 Reputation points
2024-11-17T00:39:23.39+00:00

I need to run an Azure function bimonthly aka twice a month.

I have what I think is a valid cron expression but it doesn't seem to run!
"15 0 1,15 * *"
However if I debug it locally it runs.

When it was just one day:

"15 0 1 * *"
It was Ok.
But now I've set it to run on 1st and 15th - it doesn't seem to run.

Any clues?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,936 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Khadeer Ali 5,990 Reputation points Microsoft External Staff Moderator
    2024-11-18T02:38:56.67+00:00

    Hi Dafydd Owen,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    I understand you're experiencing issues with your Azure Function not triggering on the 1st and 15th of each month using the cron expression "15 0 1,15 * *". It's great to hear that it runs as expected locally. This behavior might be due to how Azure Functions handle time zones.

    By default, Azure Functions use UTC (Coordinated Universal Time) for scheduling cron triggers. This means the function will execute based on UTC, not your local time zone. If you're working in a different time zone, it’s important to account for this difference when setting the trigger.

    For Example, for IST (Indian Standard Time) the Cron Expression for IST (UTC +5:30): Use 30 18 1,15 * * to schedule the function to run at 12:00 AM IST on the 1st and 15th of the month.

    Your expression "15 0 1,15 * *" is correct in local because it translates to:

    • Second: 15 (at 15 seconds past the minute)
    • Minute: 0 (at the top of the hour)
    • Hour: 0 (midnight)
    • Day-of-month: 1,15 (on the 1st and 15th of the month)
    • Month: * (every month)
    • Day-of-week: * (any day of the week) We can see the below link for the same which we can use ncrontab validator

    https://ncrontab.swimburger.net/?expression=15+0+1,15++

    User's image

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.