我有一个C#脚本Azure函数,并将一个blob绑定为function.json中的输出:
"bindings": [
...
{
"type": "blob",
"name": "eventOutputBlob",
"path": "event-receiver-queue-container/{rand-guid}",
"connection": "DomBlobStorage",
"direction": "out"
}
],
"disabled": false
}
我在查找如何在run.csx代码中引用{rand-guid}参数时遇到了麻烦,因此我可以将其存储在队列中以供以后处理。这可能吗?
这不起作用,但是与我希望在run.csx中得到的一致:
public static async Task<HttpResponseMessage> Run(
HttpRequestMessage req,
string rand-guid,
Stream eventOutputBlob,
TraceWriter log) {
...
}
事实证明这样做的方法是更改方法签名以绑定到CloudBlockBlob
而不是Stream
:
public static async Task Run(
HttpRequestMessage req,
string rand-guid,
Stream eventOutputBlob, CloudBlockBlob queueOutputBlob,
TraceWriter log) {
...
}
并修改function.json以包含inout
每个这Github issue:
"bindings": [
...
{
"type": "blob",
"name": "eventOutputBlob",
"path": "event-receiver-queue-container/{rand-guid}",
"connection": "DomBlobStorage",
"direction": "out" "direction": "inout"
}
],
"disabled": false
}
现在我可以调用queueOutputBlob.Name
来获取blob的名称,在这种情况下等于{rand-guid}
。