简体   繁体   English

Azure Function Blob触发器-容器名称为设置

[英]Azure Function Blob Trigger - Container Name as Setting

I'm trying to create an Azure function that connects to a container that is not hard-coded, much like my connection. 我正在尝试创建一个Azure函数,该函数连接到未经硬编码的容器,就像我的连接一样。

  public static void Run(
[BlobTrigger("Container-Name/ftp/{name}", Connection = "AzureWebJobsStorage")]Stream blobStream, 
string name, 
IDictionary<string, string> metaData, 
TraceWriter log)

The connection property is able to get the connection value directly from local.settings.json. connection属性能够直接从local.settings.json获取连接值。 It does not appear that capability is an option for "container-name", or if so, not with the appended /ftp/{name}. 似乎功能不是“容器名称”的选项,或者,如果不是,则不带附加的/ ftp / {name}。

So, is there a way to set the container name based on settings for an Azure Function Blob Trigger? 因此,有没有一种方法可以根据Azure Function Blob触发器的设置来设置容器名称?

You can define your function like this: 您可以这样定义函数:

public static void Run(
    [BlobTrigger("%mycontainername%/ftp/{name}", Connection = "AzureWebJobsStorage")]
    Stream blobStream, 
    string name, 
    IDictionary<string, string> metaData, 
    TraceWriter log)

and then define an application setting called mycontainername to contain the actual container name. 然后定义一个名为mycontainername的应用程序设置以包含实际的容器名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM