gpt4 book ai didi

Azure 函数触发器不适用于 cosmosdb 的不同资源 ID

转载 作者:行者123 更新时间:2023-12-03 00:59:50 25 4
gpt4 key购买 nike

我正在尝试创建一个 azure 函数 cosmosdbtrigger 。与我的 azure 函数相比,我的 cosmosdb 位于不同的资源 id 中。但是我的函数没有被触发。

azure 函数和 cosmosdb 是否应位于同一资源 id 中,是否有任何限制。如果没有,是否需要对不同的资源 ID 进行任何其他设置。

我的 azure 函数是在 Linux 应用服务上运行的 python 上实现的。从我了解到的 azure 文档中,我无法混合 Windows 和 Linux 的应用程序服务作为当前的限制。

Azure Documentation on Current Limitation

我需要使用 azure 函数 Python 来检查 azure cosomos db 更改源。

这是我的 function.json,用于连接到 cosmosdb 集合触发器..

{
"scriptFile": "__init__.py",
"bindings": [
{
"type": "cosmosDBTrigger",
"name": "documents",
"direction": "in",
"leaseCollectionName": "leases1",
"connectionStringSetting": "devcosmosdb_DOCUMENTDB",
"databaseName": "devcosmosdb",
"collectionName": "testCollection",
"createLeaseCollectionIfNotExists": "true"
}
]
}

最佳答案

没有这样的限制。

请再次检查databaseNamecollectionNameconnectionStringSetting

如果您已将该功能部署到 Azure 门户。您需要将连接字符串设置添加到应用程序设置。在您的场景中,您应该像这样添加连接字符串

enter image description here

您可以在 cosmosdb 帐户的Keys部分找到连接字符串。

enter image description here

此外,请检查防火墙设置。

enter image description here

关于Azure 函数触发器不适用于 cosmosdb 的不同资源 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62408892/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com