Azure Functions Timer Triggers

Timer triggers allow you to execute Azure Functions on a schedule. This page provides an overview and examples for creating and configuring timer triggers.

Learn More on Docs

Example: Simple Timer Function

This example demonstrates a basic timer function that executes every 5 minutes.

function (context) { var timer = context.req.time; console.log('Timer triggered: ' + new Date()); context.res.writeHead(200); context.res.write('Hello from Azure Functions Timer!'); context.res.end(); }

The context object provides access to various resources, including:

  • context.req: Contains information about the incoming request.
  • context.res: Allows you to send a response.
  • context.log: Used for logging messages.
  • context.time: Provides the current time for scheduling.

Configuring Timer Triggers

You can configure timer triggers by setting the following parameters:

  • Cron Expression: Defines the schedule for the timer.
  • Minimum Interval: The minimum interval between executions.
  • Maximum Interval: The maximum interval between executions.

Refer to the documentation for more details on configuring timer triggers.