How to specify multiple file types for Azure Function Blob Trigger input binding?

风格不统一 提交于 2021-01-07 03:53:55

问题


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:

回答1:


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.



来源:https://stackoverflow.com/questions/63946832/how-to-specify-multiple-file-types-for-azure-function-blob-trigger-input-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!