Edit

Share via


Azure Cosmos DB for MongoDB (vCore) bindings for Azure Functions

The Azure Cosmos DB for MongoDB (vCore) extension supports trigger, input, and output bindings for Azure Cosmos DB for MongoDB (vCore).

Important

The Azure Cosmos DB for MongoDB (vCore) extension is currently in preview.
At this time, only .NET apps that use the legacy in-process model are supported.

Using the Azure Cosmos DB for MongoDB (vCore) extension, you can build functions that can:

Action Trigger/binding type
Execute on changes to a collection Azure Cosmos DB for MongoDB (vCore) trigger
Write documents to the database Azure Cosmos DB for MongoDB (vCore) output binding
Query the database Azure Cosmos DB for MongoDB (vCore) input binding

Considerations for the Azure Cosmos DB for MongoDB (vCore) extension:

  • Only C# apps that use the legacy in-process model are currently supported in preview.
  • The Azure Cosmos DB for MongoDB (vCore) binding extension doesn't currently support Microsoft Entra authentication and managed identities.
  • Your app must be using version 4.x of the Azure Functions runtime.

Supported APIs

This table indicates how to connect to the various Azure Cosmos DB APIs from your function code:

API Recommendation
Azure Cosmos DB for NoSQL Use the Azure Cosmos DB binding extension
Azure Cosmos DB for MongoDB (vCore) Use the Azure Cosmos DB for MongoDB binding extension, which is currently in preview.
Azure Cosmos DB for Table Use version 5.x or later of the Azure Tables binding extension.
Azure Cosmos DB for Apache Cassandra Use a native client SDK.
Azure Cosmos DB for Apache Gremlin (Graph API) Use a native client SDK
Azure Cosmos DB for PostgreSQL Use a native client SDK.

Install extension

Add the extension to your .NET project for an in-process app by installing this preview NuGet package:

Microsoft.Azure.WebJobs.Extensions.AzureCosmosDb.Mongo

Note

Don't try to install this package in a .NET isolated worker process app. There will be errors and the app project won't build. To learn how to create a .NET app that uses the legacy in-process model, see Develop legacy C# class library functions using Azure Functions.