ericOnline
ericOnline

Reputation: 1977

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

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.

Upvotes: 1

Views: 2326

Answers (1)

suziki
suziki

Reputation: 14088

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:

enter image description here

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

Upvotes: 1

Related Questions