Azure Functions let us execute our code in a serverless environment. This does not require create a solution or publish it as Azure Apps. In short, just focus on code and your functional aspect, and don’t need to worry about infrastructure. We can create a function triggered when data is added to or changed in Azure Cosmos DB and further we can take it for processing using the Azure Function.
We follow the below steps to create a Function trigger for Azure Cosmos DB
1. Create a new Azure Function App
2. Create Azure Cosmos DB trigger
3. Setup the Cosmos DB Trigger with required details.
Must Read :
5 simple steps to create and test your first Azure Function App
Well, on the other hand, you can Add an Azure Cosmos DB trigger to an existing Azure Function app from Azure Cosmos DB Portal itself.
To achieve that, Open the Cosmos DB Resource in the Azure Portal and select “Add Azure Function” from the Settings section.
In the “Add Azure Function” dialog, select the collection and an existing Azure Function for which you want to add the trigger.
Click on “Save”
In this case, you must ensure your Azure Function app is in the same resource group of your Azure Cosmos DB.
That’s it. Once trigger creation and update are complete, you will be redirected to the Azure Function for which you added the trigger.
You can then further update your Azure function from here.
Hope this helps.
Pingback: Dew Drop - February 9, 2018 (#2662) - Morning Dew
Pingback: Azure Weekly: Feb 12, 2018 – Build Azure