What is the role of a trigger in an Azure Function?
- A trigger defines how and when a function is invoked.
- Examples: HTTP requests, queue messages, blob changes, timer events.
- Every function must have exactly one trigger.
Example (HTTP trigger):
[FunctionName("HttpTriggerFunction")]
public static IActionResult Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post")]
HttpRequest req,
ILogger log)
log.LogInformation("HTTP trigger executed.");
return new OkObjectResult("Hello from Azure Function!");