Wang Kangli Thanks for posting your question in Microsoft Q&A. Based on the description, you follow the training module Chain Azure Functions together using input and output bindings and faced error: Cosmos DB connection configuration 'CosmosDB' does not exist. Make sure that it is a defined App Setting.
when trying Cosmos Input binding.
If you use 4.2.0
(or later) of Microsoft.Azure.WebJobs.Extensions.CosmosDB
in your project file (.csproj), then attributes collectionName
, ConnectionStringSetting
are not available (only available in older version (v3)) and hence you faced the error.
Check out Attributes doc for the properties of both Extension 4.x+ and Functions 2.x+ versions.
Modify your function.json
as below and validate.
{
"name": "bookmark",
"direction": "in",
"type": "cosmosDB",
"connection": "my-database_DOCUMENTDB",
"databaseName": "func-io-learn-db",
"containerName": "Bookmarks",
"id": "{id}",
"partitionKey": "{id}"
}
If you still face any issues, share your project file reference info, function runtime version, Core Tools version (if local), and how request was made (URL, request body etc.) that would help in understanding it better. I hope this helps with your question and let us know if any questions.
If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.