Scenario:
- EventGrid-triggered Azure Function
- EventGrid messages created when blobs uploaded to any container within a Storage Account
- I am successfully limiting EventGrid messages, using Advanced Filters, for the following FileTypes
Key: Subject
Operator: String ends with
Value: .txt, .json etc.
I now need to filter which Blob Containers trigger an EventGrid message.
Sample EventGrid Subject:
"subject": "/blobServices/default/containers/vnd-test/blobs/sample.zip"
How do I use EventGrid Advanced Filters to NOT TRIGGER when blobs are uploaded to vnd-test
container?
Tried:
Key: Subject
Operator: String is not in
Value: vnd-test
But the EventGrid message still fires and triggers the Function.
Ideas?
I know what you want to do, but now there is no corresponding operatorto implement your idea in the event grid.
I can briefly explain to you why the event grid does not refuse to receive events sent to the vnd-test container.
The structure of blob created event is like below:
When you set
subject
string is not in
["vnd-test"]
, in fact it is doing:For example, if a file named 111.txt been sended to vnd-test. It conducts the following thought process:
1, Is
/blobServices/default/containers/vnd-test/111.txt
one of the elements of the collection["vnd-test"]
?2, No, it is not. That is great! I will accept this event because it meets the condition.
3, event grid was very happy to create the blobcreated event and send this event to the function endpoint, so your function is triggered
It does not compare part of the string inside the subject with vnd-test, but uses the entire subject to compare with vnd-test. However, the subject is refined to the blob level, how can it be possible to write every possible blob to the collection? The current operator does not support your idea.