1

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!

Amey P
  • 37
  • 4

1 Answers1

0

I notice you use */myblob as the name, but this is no use.

For example, if you want the function be triggered when something send to a folder such as test under rootContainer, you need to use this function.json:

{
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "rootContainer/test/{name}",
      "connection": "AzureWebJobsStorage"
    }
  ]
}

The path needs to be defined at compile time.

halfer
  • 19,824
  • 17
  • 99
  • 186
Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
  • Thanks for your suggestion....!!! The scenario I am looking for is different.... There are around 3000 subfolders, and file can land into any one of them, so can I have a blob trigger to initiate if the file comes in any of those sub folders.... – Amey P Oct 05 '20 at 03:40
  • @AmeyP Hi, sorry for reply too late. You can set the trigger condition as the parent folder of your 3000 folders. In this way, the files you pass into each folder can be processed. If you want to trigger each folder individually, then you can only choose to create 3000 triggers. Let me know whether this can answer your doubts. – Cindy Pau Oct 07 '20 at 07:00
  • @AmeyP If you need to process the files in each folder differently, you can take the name of the blob after setting the parent folder as the trigger condition, and write a logic to match the prefix. (Blob Storage is flat storage, so the folder information will be used as the prefix of the blob name.) – Cindy Pau Oct 07 '20 at 07:06