如何为Azure Function Blob触发器输入绑定指定多种文件类型? [英] How to specify multiple file types for Azure Function Blob Trigger input binding?

查看:49
本文介绍了如何为Azure Function Blob触发器输入绑定指定多种文件类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望只允许将特定文件类型上载到Azure存储以触发Azure功能.

当前 function.json 文件:

  {"scriptFile":"__ init__.py",绑定":[{名称":"myblob","type":"blobTrigger",方向":中","path":"{name} .json",连接":"storage-dev"}]} 

我是否要添加另一个 path 值,像这样...

 "path":"{name} .json",路径":"{name} .csv"; 

...或诸如此类的值数组...

 "path":["{name} .csv"," {name} .json"] 

似乎无法在

解决方案

您希望blobtrigger同时监视两个或更多路径.

我可以简单地告诉你,这是不可能的.这就是为什么您找不到相关文档的原因,因为没有这样的东西.如果必须根据需要同时使用blobtrigger,则只能使用多个blobtrigger.

但是您还有另一个选择:eventgridtrigger:

您只需要创建多个事件网格,并让它们指向同一终结点函数即可.

I'm looking to only allow the upload of specific filetypes to Azure Storage to trigger an Azure Function.

Current function.json file:

{
    "scriptFile": "__init__.py",
    "bindings": [{
        "name": "myblob",
        "type": "blobTrigger",
        "direction": "in",
        "path": "{name}.json",
        "connection": "storage-dev"
    }]
}

Would I just add another path value like this...

"path": "{name}.json",
"path": "{name}.csv"

...or an array of values like this...

"path": [
    "{name}.csv",
    "{name}.json"
]

Can't seem to find an example in the docs.

EDIT: Thank you @BowmanZhu! Your guidance was awesome.

  • Changed trigger to EventGrid
  • Actually was able to create a single Advanced Filter rather than create multiple Subscriptions:

解决方案

You want a blobtrigger to monitor two or more paths at the same time.

I can tell you simply, it's impossible. This is why you can't find the relevant documentation, because there is no such thing. If you must use blobtrigger at the same time according to your requirements, you can only use multiple blobtrigger.

But you have another option: eventgridtrigger:

You just need to create multiple event grid, and let them point to the same endpoint function.

这篇关于如何为Azure Function Blob触发器输入绑定指定多种文件类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆