Introduction
PaaS (Platform as a Service) allows us to deploy and manage individual code functions without a need to deploy and manage on the individual Virtual Machine (VM). It is also known as Serverless computing. Azure Functions is a serverless compute service that runs our code on demand without needing to host it on the server and manage infrastructure. Azure Functions allows us to write code in various languages, such as C#, F#, Node.js, Java, or PHP. It can be triggered by a variety of events such as HTTPTrigger, TimerTrigger, QueueTrigger, etc. In my previous article, we learned about creating Azure Functions and looked at HTTP-triggered functions using the Azure portal.
In this article, we will learn about Timer-triggered Azure Functions.
The time-triggered Azure Function allows us to schedule time for executing the function. It means that it triggers the function at a specified time. It works as CRON expressions work. When creating a time-triggered function, we need to specify a time in CRON format that determines when the trigger will execute. The CRON expression consists of six parts - second, minute, hour, day, month, and day of the week in Azure Function, and each part is separated by space. We can specify the following special characters inside the expression.
- A comma (,) is used to specify a list of values.
- A forward slash (/) is used to reoccur execution time.
- An asterisk (*) indicates that the expression can have any value.
- A hyphen (-) indicates a range of values.
Apart from this, the following things need to be taken care of.
- To specify days or months, we can use numeric values or abbreviations of names.
- Numeric values 0 to 6 are used for the day where 0 starts with Sunday.
- If we specify the name, the name must be in English and names are case-insensitive.
- If we use a name abbreviation, three letters are the recommended length.
- The default timezone used with the CRON expression is Coordinated Universal Time (UTC). We can create CRON expressions based on other time zones by specifying. "WEBSITE_TIME_ZONE" app setting for the function app.
The format of the CRON expressions in Azure is,
{second} {minute} {hour} {day} {month} {day of the week}







Michelle SollicitoPosted Nov 21, 2019, 8:53 AM
Help me - how do I unit test timer triggered functions? If I want to call MyFunc.Run() - I need to pass the first parameter as a TimerTrigger - how do I do that?