I created an event-triggered function in Azure (name of the function app: "stamevents", name of the function: "EventGridTrigger1". this is my function.json file:
{
"scriptFile": "__init__.py",
"bindings": [
{
"type": "eventGridTrigger",
"name": "event",
"direction": "in"
}
]
}
and this is my init.py file:
import json
import logging
import azure.functions as func
def main(event: func.EventGridEvent):
result = json.dumps({
'id': event.id,
'data': event.get_json(),
'topic': event.topic,
'subject': event.subject,
'event_type': event.event_type,
})
logging.info('Python EventGrid trigger processed an event: %s', result)
Now, I want to trigger this function when I'm uploading a blob. So I went to my storage account, pressed on "Events" and chose "Azure Function". and create.
Next I chose the function app and the function I just created
But this is what I see and I don't understand what to do next, and how to make this function fire after I upload a blob.
Any help will be appreciated!
CodePudding user response:
I have reproduced in my environment and i got expected results. I followed this workaround: You can use Microsoft.Storage.BlobCreated as below in using azure functions:
Click on Azure functions in end point type then click on end point as below:
Upload a blob like below:
After uploading blob check the logs of event grid function app as below, you will get to know it has executed and event grid got triggered as below:
You can use Logics apps for triggering an event when a blob is created as below:
And when i upload a blob like below it runs and gets triggered as below:
Now when you check the run history it trigered as below:
And you can check as below:
So, in last you can check the events i created as below: