Azure Cosmos DB trigger and bindings for Azure Functions 2.x and higher overview
This set of articles explains how to work with Azure Cosmos DB bindings in Azure Functions 2.x and higher. Azure Functions supports trigger, input, and output bindings for Azure Cosmos DB.
|Run a function when an Azure Cosmos DB document is created or modified||Trigger|
|Read an Azure Cosmos DB document||Input binding|
|Save changes to an Azure Cosmos DB document||Output binding|
This binding was originally named DocumentDB. In Functions version 2.x and higher, the trigger, bindings, and package are all named Cosmos DB.
Azure Cosmos DB bindings are only supported for use with the SQL API. For all other Azure Cosmos DB APIs, you should access the database from your function by using the static client for your API, including Azure Cosmos DB's API for MongoDB, Cassandra API, Gremlin API, and Table API.
Add to your Functions app
Functions 2.x and higher
Working with the trigger and bindings requires that you reference the appropriate package. The NuGet package is used for .NET class libraries while the extension bundle is used for all other application types.
|C#||Installing the NuGet package, version 3.x|
|C# Script (online-only in Azure portal)||Adding a binding||To update existing binding extensions without having to republish your function app, see Update your extensions.|
Functions 1.x apps automatically have a reference the Microsoft.Azure.WebJobs NuGet package, version 2.x.