0

I'm getting the following error when I attempt to create an event subscription for blobCreated:

enter image description here

When there is a new blob in a container, I'd like that event to be forwarded to a topic.

I went to the storage account, and attempted to create an event subscription:

enter image description here enter image description here enter image description here

What am I doing wrong? How do we push blob storage events to an event grid topic?

Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062

2 Answers2

4

The AEG doesn't handle a subscription webhook endpoint validation for custom topic endpoint, however there is a workaround for this missing feature, see more details here.

The concept of the AEG cascading is to subscribe for that custom topic and its subscriber will handle a validation via a http GET call.

I do recommend to create a custom topic endpoint with a CustomInputSchema otherwise the blob storage event will be nested in the event data object.

UPDATE:

The following is more details about the AEG-To-AEG integration such as a cascading (forwarding) a source events.

Note, that this integration (see below picture) is not full supported by current version of the AEG, in other words, the custom topic endpoint doesn't have built-in a validation response:

enter image description here

During the subscription handshaking with the webhook endpoint the following event message (example for blob storage) is sent to the endpoint:

[
  {
    "id": "c2ad3900-f483-4e45-a15b-927195878e99",
    "topic": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myRG/providers/Microsoft.Storage/storageAccounts/myStorage",
    "subject": "",
    "data": {
      "validationCode": "00000000-0000-0000-0000-000000000000",
      "validationUrl": "https://rp2-westus.eventgrid.azure.net:553/eventsubscriptions/cascade/validate?id=04B6279C-A6ED-4FC0-981A-D9E53312B49A&t=2019-08-22T05:12:44.3114422Z&apiVersion=2019-02-01-preview&token=xxxxxxxxxxxxxx"
      },
    "eventType": "Microsoft.EventGrid.SubscriptionValidationEvent",
    "eventTime": "2019-08-22T05:12:44.3114422Z",
    "metadataVersion": "1",
    "dataVersion": "2"
  }
]

The event subscription is waiting for validation response either by programmatically (response with a validationCode) or manually (sending a GET request to validationUrl).

For this kind of integration we have to use a manually validation such as sending a GET request. For this purpose we have to create a subscriber to handle a manually validation on the custom topic.

The following picture shows this solution:

enter image description here

Implementation of the EventGridTrigger function for manually validation is described here.

As you can see the above event validation message, the subject property is empty, so we can handle this case and also the case of nested (cascading) an event data, the custom topic endpoint should be created with a CustomEventSchema. The following is an example of the property object in the request payload:

 "properties": {
    "inputSchema": "CustomEventSchema",
    "inputSchemaMapping": {
      "properties": {
        "id": {
          "sourceField": null
        },
        "topic": {
          "sourceField": null
        },
        "eventTime": {
          "sourceField": null
        },
        "eventType": {
          "sourceField": null,
          "defaultValue": "notification"
        },
        "subject": {
          "sourceField": null,
          "defaultValue": "/webhook/events"
        },
        "dataVersion": {
          "sourceField": null,
          "defaultValue": "1.0"
        }
      },
      "inputSchemaMappingType": "Json"
    }
  }

Notes:

  1. The custom topic aeg-sas-key value must be url encoded in the webhook endpoint address.
  2. The advanced filter for validator can be used:

     "advancedFilters": [
          {
            "values": [
              "Microsoft.EventGrid.SubscriptionValidationEvent"
            ],
            "operatorType": "StringContains",
            "key": "Data.EventType"
          }
        ]
    
Roman Kiss
  • 7,925
  • 1
  • 8
  • 21
  • im sorry i've reread your response many times and went to the links to try to understand, and have failed to understand. might be over my head – Alex Gordon Aug 21 '19 at 23:25
  • thanks so much really appreciate your thorough explanation ! i think i get it now. if i may ask, where can i get those azure component graphics that you are using in your design? – Alex Gordon Aug 22 '19 at 16:11
  • https://github.com/Lkeckley/Microsoft-Azure-Cloud-and-Enterprise-Symbol-Icon-Set/blob/master/Microsoft_CloudnEnterprise_Symbols_v2.7.zip and https://www.microsoft.com/en-us/download/details.aspx?id=41937 – Roman Kiss Aug 22 '19 at 17:13
0

I faced the same issue and solved it in minutes using a logic app to relay the event to my custom topic. No need to create an event subscription on the storage account, the logic app automatically added the appropriate webhook after it was set up: enter image description here