Schedule Azure Function App to run on last day of every month

Dinesh Prajapati 126 Reputation points
2023-03-30T05:18:14.58+00:00

Hi team,

I have one azure function timer trigger app which I need to run on last day of every month.

I have tried to use cron expression "15 10 L * *" but it gives me error that the expression is not correct. I have setup the azure function app using Visual Studio Code.

could you please help me on this

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

Accepted answer
  1. MayankBargali-MSFT 68,471 Reputation points
    2023-03-31T09:51:35.3633333+00:00

    @Dinesh Prajapati Thanks for reaching out. Azure function leverage NCRONTAB expressions as documented here. L is invalid for NCRONTAB expression as the last day of the month.

    The workaround will be triggering your function app everyday as per your business requirement and inside your function check whether today's date is the last day of the month. If it is the last day of the month then only execute your business logic inside the true condition.

    For example, in C# you use below statement to check whether today's date is the last month of the day or not as on the first expression I am getting the next month by adding one to the month and comparing with the today's day plus on day and if both are equal then it means last day of the month.

    if (DateTime.Now.AddMonths(1).ToString("MM") == DateTime.Now.AddDays(1).ToString("MM"))

    For any product feedback and feature request you can always reach out to us in feedback forum here where product team is actively monitoring the feedback to improve our products.

    Feel free to get back to me if you have any queries or concerns.

    Please accept as "Yes" if the answer is helpful so that it can help others in the community. If you need any help/clarification/concerns/follow up questions, then please click on "Add Comment" on my answer and provide more details.


0 additional answers

Sort by: Most helpful