Using Timer Triggers

Learn how to implement a timer trigger in Azure Functions.

A timer trigger is used to execute a function at specific timed intervals. This is how we can turn a function into a scheduled job. We have an example of this in the following interactive playground:

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;

namespace TimerTriggerDemo
{
    public class Functions
    {
        [FunctionName("TimerDemo")]
        public void Run([TimerTrigger("0 * * * * *")]TimerInfo myTimer, ILogger log)
        {
            Console.WriteLine($"C# Timer trigger function executed at: {DateTime.Now}");
        }
    }
}
Function with a timer trigger

Timer trigger basics

To configure a timer trigger on a function method, we need to pass a parameter into the method of the TimerInfo type. This parameter needs to have a TimerTrigger attribute with a Cron expression, which is used to configure the schedule. We have an example of this in ...