0

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". enter image description here 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.

enter image description here

Any help will be appreciated!

2
  • Plz check this link to associate blog storage trigger to an Azure function - learn.microsoft.com/en-us/azure/azure-functions/… Commented Sep 13, 2022 at 16:18
  • @Gandhi, I'm not looking for a blob trigger but for an event trigger. Commented Sep 13, 2022 at 17:21

1 Answer 1

1

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:

enter image description here

Click on Azure functions in end point type then click on end point as below:

enter image description here

Upload a blob like below:

enter image description here

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:

enter image description here

You can use Logics apps for triggering an event when a blob is created as below:

enter image description here

And when i upload a blob like below it runs and gets triggered as below:

enter image description here

Now when you check the run history it trigered as below:

enter image description here

And you can check as below:

enter image description here

So, in last you can check the events i created as below:

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Hey, Thank you, super helpful! How do I connect only a specific storage account or even a specific container to the blobCreated event?
Please refer SO-Thread for specific container which I and Op answered.
Can we please have a quick call? I'll be happy to pay you for your help... my mail is [email protected], can you please contact me?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.