Timer trigger binding

The Timer trigger allows you to run a function on a schedule. The schedule is defined using a CRON expression or a simpler schedule format.

Overview

A Timer trigger is a background task that runs without any HTTP request or external event. It is ideal for periodic cleanup, data aggregation, or any recurring job.

Example (C#)

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

public static class TimerTriggerFunction
{
    [FunctionName("TimerTriggerFunction")]
    public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
    {
        log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
    }
}

Supported attributes

AttributeDescription
scheduleCRON expression that defines the schedule.
runOnStartupIf true, the function runs once when the host starts.
useMonitorEnables built‑in monitoring of the timer status.

CRON expression format

The CRON format for Azure Functions has six fields:

{second} {minute} {hour} {day} {month} {day-of-week}

Example: 0 */5 * * * * – every 5 minutes at the start of a minute.

Best practices

  • Keep the function execution time short; use durable functions for long‑running processes.
  • Use RunOnStartup cautiously to avoid duplicate work on host restarts.
  • Monitor failures using Application Insights or the built‑in timer monitor.