Reputation: 106
I want to run a powershell script on the 28th of each month at 23:00 UTC using azure. I am exploring azure logic apps and function apps and would ideally like to use a combination but either one would work as well.
I have tried using TimerTrigger in function apps and my initial thought was that using CRON it would be straightforward and I came up with 0 0 23 28 * ? *
. But I just realised that the day parameter only accepts 0-6 for the 7 days of the week.
In logic apps, I could not find anything other than a frequency setter which would allow me to run it once a month but doesn't give control over time.
Can anyone please suggest a way around this?
Upvotes: 0
Views: 3038
Reputation: 4119
It can be achieved using just CRON
expressions in Azure Functions.
CRON Expression - 00 23 28 * *
Ignore the date. i wrote it as 27. You can just put it as 28
I created a function app to validate this as OP mentioned it is not working. Here's the function runtime console with calculated dates.
This is what my code looks like
[FunctionName("TimeTrigger")]
public static void Run([TimerTrigger("0 23 27 * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
Upvotes: 2
Reputation: 14334
Azure function use NCRONTAB library , further more details you could refer to this doc:NCRONTAB expressions. The cron format should be {second} {minute} {hour} {day} {month} {day-of-week}
.
If you want to set the timer at 28th of each month at 23:00 UTC, you could try this cron expression:0 0 23 28 * *
.
About logic app you are right, for now it only support the frequency schedule, it could not implement the detailed time schedule.
Upvotes: 2