|Author||Jef Meijvis||Publish date||12/03/2022|
|Title||Azure functions part 2 - Triggers and bindings||Id||4|
|Source||004-azure-functions-part-2-triggers-and-bindings.md||Render timestamp||Dec 06, 2023, 06:08:30 AM (GMT+1)|
|Title||Azure functions part 2 - Triggers and bindings|
|Render timestamp||Dec 06, 2023, 06:08:30 AM (GMT+1)|
Share this post:
For part one, see Azure Functions : part 1
A trigger is what causes your Azure function to run. It defines how and when your function is invoked. To have a working function, you need exactly one trigger.
A binding is a way to connect your function to other resources, such as Cosmos DB, Service Bus, Blob Storage and many others. Bindings are often available in both the in and out direction, depending on what your usecase is.
Let's clarify this with an example. Imagine a blob storage bucket that gets used to upload a bunch of excel files. At the end of every day, we want to run a function that goes over all these files, and write a summary to a database. In such case our function would need the following properties:
Input binding: Azure Blob Storage
Output binding: Azure Cosmos Database
Image: A trigger, input and output binding make up this Azure function
The following triggers are currently supported by Azure Functions. They will provide the start signal for your function to begin execution.
Image: Available triggers in Azure Functions
Every function can be run manually by performing an http request, independently from which kind of trigger is used. This can be usefull for when you want to debug something, or manually kickstart a function. For more information see the Microsoft documentation
Sometimes we need our function to retrieve data from somewhere else. This is where we need our input bindings. The following input bindings are currently available:
Image: Available input bindings in Azure Functions
After your code has executed inside your function, you might want to send the results to another resource. Output bindings allow you to send your function's outcome to another resource.
Image: Available output bindings in Azure Functions