azurecronazure-functionstimer-trigger

Run Azure Function 2 days before end of month


Is it possible to use a Timer trigger to run an Azure function 2 days before end of month?

I tried 0 0 0 L-2 * *, but it is not allowed.

Invalid Cron Expression.

When I use https://crontab.cronhub.io/ with my cron expression, I get my expected result At 12:00 AM, 2 days before the last day of the month.


Solution

  • Unfortunately, as per your requirement as there is no CORN expression that can help in your case.

    You need to create a custom solution by creating a timer trigger function that would be running every day. You need to write your custom logic to validate whether current date is equal to last or second last day of the month. If it is true then inside the condition you can write your business logic for further processing.

    Refer to similar case (where customer want to avoid the execution of workflow on first and last day of the month) to implement your custom logic.