Azure function blob trigger for subfolders

Amey Pimpley 21 Reputation points
2020-10-05T21:05:03.857+00:00

I have a container folder where there are many sub-folders(around 3000), a file can land in any of the sub-folders. I need to react to a blob that's added into a sub-folder. I still can't figure out how to create a blob trigger if files are added to sub-folders.

Example:

Excerpt from function.json:
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "rootContainer/{name}"
}

OK, a function is triggered if I receive the blob in rootContainer folder

Except from function.json:
{
"name": "/myblob",
"type": "blobTrigger",
"direction": "in",
"path": "rootContainer/{name}"
}
or
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "rootContainer/
/{name}"
}
NOT OK, a function isn't triggered

There are not many questions regarding this problem and they still don't provide a normal answer. Can't find any info in documentation either.

Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,189 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,408 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 67,991 Reputation points
    2020-10-06T03:21:36.09+00:00

    Hi @Amey Pimpley

    The first function.json content that you used should work for you. I have created function from the Azure portal and have also tested locally and didn't observe any issue. When there is any blob uploaded to any of the subfolders the function app is getting triggered. You can refer to blob trigger input binding document.

    If you are created function from the Azure portal make sure that you have defined the connection parameter.

    30277-image.png

    In the below logs you can see it works when there is a file uploaded in subdirectories.

    30078-image.png

    If you are still facing the issue please let me know so I can connect with you offline and assist you further.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    3 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Rajnish Sharma 1 Reputation point
    2021-04-08T10:11:02.363+00:00

    source:
    BlobTrigger("staging/{name}/lots/images"

    Destination:
    [Blob("staging/{name}/lots/thumbnails/{name}_thumbnail"

    BlogTrigger not triggering when image added in subdirectory

    0 comments No comments