I created an isolated Azure functions for cosmosDB trigger. I'm using Microsoft.Azure.Functions.Worker.Extensions.CosmosDB --version 4.0.0-preview2 to use managed identity. Below is my function.
[Function("CosmosDBTrigger")]
public void Run([CosmosDBTrigger(
databaseName: "testdata",
containerName: "test",
Connection = "connect",
LeaseContainerName = "leases")] IReadOnlyList<MyDocument> input)
{}
local.settings.json
{
"Values": {
connect__accountEndpoint": "https://testdatacosmosdb.documents.azure.com:443/"
}}
I get the error "Cosmos DB connection configuration 'connect' does not exist. Make sure that it is a defined App Setting. I'm not sure if it happening because of isolated azure functions
You are missing the credentials. See:
All Azure Functions bindings that are going to use MSI need the
<your attribute value>__credentialin the configuration besides the Service Specific properties.For Cosmos DB, the Service Specific property is
accountEndpoint.To summarize, you need to have both.
In your
local.settings.jsonfile:Once deployed in Azure, you need to add them to your Functions App Configuration, for that you can use the underscore notation:
Here is also an Azure Friday episode of the whole scenario end to end: https://www.youtube.com/watch?v=w002dYaP9mw