A trigger is the entry point that tells an Azure Function when to run. Every function has exactly one. A Blob Storage trigger runs the function when it detects a new or updated blob in a container; an HTTP trigger runs it when its web endpoint is called. Trigger data can also be passed into the function, so it has something to work on. section 8.2.1 section 8.6
Suppose incoming emails contain images that need resizing. A Logic App can copy each attachment into Blob Storage. A Blob Storage trigger then starts the resizing function when the file arrives—no one needs to press a Run button. section 2.2.21
To set up that function in the Azure portal:
- Create a function from the Azure Blob Storage Trigger template and select its storage-account connection. section 2.2.18
- Set the path to imagecontainer/{name}. The path identifies the container to watch, while {name} supplies the detected file’s name. section 2.2.18
- If the function produces a resized file, add a separate Blob Storage output binding, such as imageoutputcontainer/{rand-guid}. The trigger starts the work; the output binding gives the result a destination. section 2.2.19
Another entry point: HTTP
For a function called by a web request, the HTTP trigger template replaces the blob trigger. Its Run method receives an HttpRequest parameter containing request data. When creating this kind of function, choose an authentication level—anonymous, function, or admin—appropriate to who may call it. section 8.2 section 8.2.1
Do not confuse a Function trigger with a Logic App trigger. Both start work, but a Logic App trigger starts a workflow, while a Function trigger invokes one function. In the email example, the Logic App starts when mail arrives; the function starts later, when the attachment reaches Blob Storage. section 2.2.10 section 2.2.21
