Search code examples
azureazure-storage-account

How to setup a Event Grid service(trigger) listen to a Resource Group for ever increasing storage blobs in multi storage account


I'm setting up a "Event Grid Subscription + Storage Queue" which wants to listen to a resource group. I hope whenever a blob is created, a event will be sent to the storage queue. meanwhile storage accounts may also expand.

I have tried many methods, but the deterrent lies: 1. Event Grid Subscription, listening to a Resource group, only generates events when a storage account is created, not a blob. I want the even of uploaded blobs

  1. "Fan-in pattern" : each Storage account has a Event Grid subscription- this method cannot scale out. because my storage accounts are ever increasing

Solution

  • Unfortunately, seems it does not support to do that via event grid subscription.

    When you create the event subscription, if you specify the Topic Type with Resource Group, the Event Types available is fixed, you could not access the event type like Blob Created which is available for storage account topic type.

    enter image description here

    My workaround is to create the event subscription along with your storage account created. Not sure which way you will use to create the storage account, but it is not difficult to create the storage account with automation, E.g. 1. use PowerShell New-AzStorageAccount, New-AzEventGridSubscription. 2. use ARM template Storage account, Event Subscriptions.