Azure Blob触发器。在配置文件中配置Blob路径

时间:2018-04-27 09:31:38

标签: azure azure-storage-blobs

我在项目中使用Blob触发器来处理文件内容。

我正在使用Azure Blob Trigger来启动文件执行过程。

{{1}}

根据代码的发布位置,blobcontainer应相应更改。我的意思是我想要" importcontainer"在配置文件中配置。我能这样做吗?

1 个答案:

答案 0 :(得分:3)

据我所知,您可以在local.settings.json中进行配置。 将下面的代码添加到文件中的Values,我的样本容器名为“workitems”。

"importcontainer": "workitems"

然后在.cs文件中更改以下代码。

public static void Run([BlobTrigger("%importcontainer%/{name}", Connection = "StorageConnection")]Stream myBlob, string name, TraceWriter log)

然后将功能发布到Azure,您应该在门户中的应用程序设置中设置importcontainer,如下面的屏幕截图所示,因为将使用该设置。

enter image description here

运行该功能并将blob添加到容器中,它可以正常使用。

enter image description here

相关问题