I don't know if this is the right place for this issue, since it seems to affect other parts of Azure architecture, not only Azure Function bindings.
I am trying to develop an Azure Function to act upon a blob created by the Capture feature of an Event Hub. However, whereas capture blobs are correctly stored on the container, it seems that no Microsoft.EventHub.CaptureFileCreated event is published to the Function subscription. The event subscription to the function endpoint has been created without errors, and the output from the Azure CLI is
{
"additionalProperties": {},
"deadLetterDestination": null,
"destination": {
"additionalProperties": {},
"endpointBaseUrl": "https://xxxxx-xxxxx-xxxxx.azurewebsites.net/api/EventGridWebhook",
"endpointType": "WebHook",
"endpointUrl": null
},
"eventDeliverySchema": "InputEventSchema",
"filter": {
"additionalProperties": {},
"includedEventTypes": [
"Microsoft.EventHub.CaptureFileCreated"
],
"isSubjectCaseSensitive": null,
"subjectBeginsWith": "",
"subjectEndsWith": ""
},
"id": "/subscriptions/yyyyy-yyyyy-yyyyyy/resourceGroups/test-event-grid-grp/providers/Microsoft.EventHub/namespaces/capture-hub-namespace/providers/Microsoft.EventGrid/eventSubscriptions/captureFunctionV1Sub",
"labels": null,
"name": "captureFunctionV1Sub",
"provisioningState": "Succeeded",
"resourceGroup": "test-event-grid-grp",
"retryPolicy": {
"additionalProperties": {},
"eventTimeToLiveInMinutes": 1440,
"maxDeliveryAttempts": 30
},
"topic": "/subscriptions/yyyyy-yyyyy-yyyyyy/resourceGroups/test-event-grid-grp/providers/microsoft.eventhub/namespaces/capture-hub-namespace",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
The body of the function is a standard Http trigger with the additional validation part needed for the Event Grid endpoint subscription
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
{
string jsonContent = await req.Content.ReadAsStringAsync();
log.Info($"Webhook was triggered! Input: {jsonContent}");
dynamic events = JsonConvert.DeserializeObject(jsonContent);
if (req.Headers.GetValues("Aeg-Event-Type").FirstOrDefault() == "SubscriptionValidation")
{
var code = events[0].Data["validationCode"];
return req.CreateResponse(HttpStatusCode.OK,
new { validationResponse = code });
}
return req.CreateResponse(HttpStatusCode.OK);
}
If I add the same function's endpoint for another type of event (f.i. a blob creation event), I can see the function invocations in the logs. Besides, in the Metrics blade of the event subscription, it seems like no event is ever published to the subscribers (no published, no failed, no unmatched).
Also, it doesn't work with either of the two versions of the runtime environment and even the EventGridTrigger attribute doesn't work.