如何将 Powershell Azure 函数连接到 DocumentDB / CosmosDB

How to connect a Powershell Azure Function to DocumentDB / CosmosDB

我将一个 Http Trigger C# 函数连接到我的 DocumentDB 数据。我在 运行 方法上添加了一个 IEnumerable<dynamic> docDBData 作为参数。

如何do/can将其传递给 PowerShell 触发器函数?

无法在 azure-webjobs-sdk-script 存储库中找到示例。不确定我是否在寻找正确的东西。

DocumentDB/CosmosDB 和 powershell 没有示例 - 但是,它应该相对简单。您的查询结果将以 json 格式存储在文件 $docDBData(假设您将绑定命名为 docDBData)中,就像其他 trigger/input 参数一样。

$in = Get-Content $triggerInput | ConvertFrom-Json;
$docDBResults = Get-Content $docDBData | ConvertFrom-Json;
...

这里有一个很好的关于 DocumentDB 绑定的资源: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-documentdb