What is a Trigger?
A trigger determines how and when a function is invoked. Azure Functions provides a variety of built‑in triggers for different workloads such as HTTP requests, timers, queue messages, and more.
Supported Trigger Types
- HTTP Trigger – Executes a function in response to an HTTP request.
- Timer Trigger – Runs on a schedule using CRON expressions.
- Blob Trigger – Fires when a new or updated blob is detected.
- Queue Trigger – Invoked when a new message appears on an Azure Storage queue.
- Event Hub Trigger – Processes events from an Azure Event Hub.
- Cosmos DB Trigger – Reacts to changes in a Cosmos DB container.
- Service Bus Trigger – Listens to Service Bus queues or topics.
HTTP Trigger Example
This sample creates an HTTP‑triggered function that returns a greeting.
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
public static class HttpTriggerFunction
{
[FunctionName("HelloWorld")]
public static IActionResult Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]
HttpRequest req)
{
string name = req.Query["name"];
return new OkObjectResult($"Hello, {name ?? "World"}!");
}
}
Show / Hide Full Code
Timer Trigger Example
Runs every minute and writes a log entry.
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
public static class TimerTriggerFunction
{
[FunctionName("TimerExample")]
public static void Run([TimerTrigger("0 */1 * * * *")]TimerInfo myTimer,
ILogger log)
{
log.LogInformation($"Timer fired at: {DateTime.Now}");
}
}
Try It Live
Use the sandbox below to test an HTTP trigger locally (simulated).