1

I am working on an Azure Functions app in Visual Studio 2022. I have two functions that use EventGridTrigger and am expecting a blob notification when an item is added/changed to blob storage.

I have the Azurite storage emulator running and can upload a file, I am trying to work out if it is possible to have it trigger an event (file added/updated etc.)

I have the AzureEventGridSimulator configured - however, it is looking like I may have to manually trigger an event.

Does anyone know if Azurite can be used fire event grid events?

Regards Andy

AndyW
  • 191
  • 1
  • 11

2 Answers2

0

Created Azure Functions .NET 6 Blob Storage trigger in VS Code and signed up to ngrok application > installed it.

Then, run the below cmdlets in the project workspace of VS Code Terminal:

dotnet add package
dotnet add package Microsoft.Azure.WebJobs.Extensions.Storage --version 5.0.1

Added the code bit Source = BlobTriggerSource.EventGrid to Blob Trigger Function declaration code.

Started local debugging by following the instructions available in this MS Doc and also publishing to the Azure Portal Function App by creating new event subscriptions in the Storage Account > Events.

2 Event Subscriptions created with the different endpoints: Local Function URL and Azure Function App URL.

Then uploaded the text files as my event subscriptions created with .txt event filters.

In the Event Subscriptions, you can see the event when blob files are uploaded to the Container:

enter image description here

Note: While creating event grid subscription in the Storage Account, you can select the filter like blob created, blob renamed, blob deleted etc.

  • 1
    Thanks, I'll take a look at it. I'm not logged in to Azure, hence the Azurite emulator, this is an offline development project. Also, I can't use third party apps such as ngrok due to the environment. – AndyW Oct 24 '22 at 18:13
  • @AndyW, did you find a solution for local testing since then? – AGK Nov 02 '22 at 12:34
  • 2
    @AGK, No sorry, I have not been able to test using the different EventGridTriggerAttribute as suggested above either. If I get a solution, I will update this post. – AndyW Nov 15 '22 at 21:13
0

This is not 100% what you would like to achieve, but if you switch from using the BlobTriggerAttribute trigger to using the EventGridTriggerAttribute, you will be able to do local testing without having to use ngrok. Unfortunately, you will still need an Azure account.

The required steps to do this are described here.

AGK
  • 95
  • 2
  • 7