如何使用 Cosmos DB 触发器构建 Azure 函数?

How to build an Azure Function with Cosmos DB Trigger?

我正在尝试在 Azure 门户中开发一个 Azure 函数 (Node.js),它在创建文档时由 Cosmos DB 触发。 Azure 文档说要这样做,首先我必须从模板中 select "Cosmos db trigger",但我的函数中没有出现模板……只出现 HTTP 和计时器触发器选项。我想使用 CosmosDB 和 IoTHUB 作为触发器、输入输出。 有什么要求被忽略了吗?为什么我没有更多触发器选项?需要指导。

您似乎创建了一个"httptrigger"函数,您需要通过模板创建Cosmos DB 触发器。请参考以下步骤: 1. 点击“+” --> "In-portal"

2.Click "More templates" --> "Finish and view templates"

3.Choose "Azure Cosmos DB trigger"

4.Click "Install"

5.Fill 在包含您的 cosmos 数据库详细信息的输入框中。

更多信息可以参考这个tutorial.