'How can I add regex in a variable value in azure function bindings file?
I have an azure function and I want to trigger it when a new blob is detected. Current bindings in functions.json:
"bindings": [
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "cfimages/{name}.png",
"connection": "ImageStorageEndpoint"
},
It works well and is triggered with "test_image.png"
Now, I want to trigger it with a a certain file name (with a certain suffix) and I wrote this:
"bindings": [
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "cfimages/_?topview.png",
"connection": "ImageStorageEndpoint"
},
I dont get an error but I cant trigger it using a file "test_topview.png". Can someone help me with the issue?
Azure trigger bindings: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-expressions-patterns
Thank you.
Solution 1:[1]
To achieve the above requirement You may need to Pass the file name path as below in your azure function binding.
Example Code for trigger file name:-
{
"bindings": [
{
"name": "image",
"type": "blobTrigger",
"path": "sample-images/{filename}",//
"direction": "in",
"connection": "MyStorageConnection"
},
For more information please refer the below links:
- MICROSOFT DOCUMENTATION:- TRIGGER FILE NAME WITH DIFFERENT TYPES
- SO THREAD :- Is it possible to create a blob triggered azure function with file name pattern?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AjayKumarGhose-MT |
