Azure Functions Documentation

Triggers

Triggers define how an Azure Function is executed. They provide a way to invoke a function based on events from Azure services or external sources. Each trigger has specific configuration options and data payloads.

Common Trigger Types

Trigger Configuration

The configuration of a trigger depends on its type. This typically involves specifying connection strings, paths, queue names, topics, or schedules.

For example, an HTTP trigger can be configured with different HTTP methods (GET, POST, etc.) and authorization levels. A Timer trigger requires a schedule property, usually in CRON format.

Example: HTTP Trigger Configuration (function.json)


{
  "scriptFile": "index.js",
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ]
}
            

Example: Timer Trigger Configuration (function.json)


{
  "scriptFile": "index.js",
  "bindings": [
    {
      "type": "timerTrigger",
      "direction": "in",
      "name": "myTimer",
      "schedule": "0 */5 * * * *"
    }
  ]
}
            

Trigger Data

When a trigger invokes a function, it passes data related to the event. The format and content of this data are specific to each trigger type.

You can find detailed reference documentation for each trigger type in the Azure Functions documentation. For more information, see the complete guide to Azure Functions triggers.