I’m developing an Azure function which should trigger with blob events based on an Event Grid subscription as explained in the following article.
I’ve been able to go through all the steps in the tutorial but cannot successfully create the subscription for the events.
This is my function’s code:
[FunctionName(nameof(TrainingsCsvUploaded))]
public async Task Run(
[BlobTrigger("%AccessAzureStorage:ProfessionalDevelopmentContainerName%/{name}",
Source = BlobTriggerSource.EventGrid,
Connection = "AccessAzureStorage:ConnectionString")] Stream myBlob,
string name, ILogger log)
{
log.LogError("C# Blob trigger function Processed blob name: '{name}'", name);
var endpoint = await _bus.GetSendEndpoint(new Uri("queue:" + Configuration["AccessSystem-CommandQueueName"]));
var command = new RefreshTrainingsInformationCommand() { BlobName = name };
log.LogInformation("Queueing command {command}", command);
await endpoint.Send(command);
}
It is deployed and the requiered configuration settings are set.
More over, the blob_extensions app key is set too.
And this is how I build the webhook URL to be provided when creating the subscription:
https://accesssystem-pre-01-fnapp.azurewebsites.net/runtime/webhooks/blobs?functionName=TrainingsCsvUploaded&code=<blob_extensions_key>
Now following the same steps in the tutorial I get the following message in the portal:
Clearly I’m missing something but I cannot figure out what, could you point me where the issue is?
Thanks in advance!
Best,
2
Answers
Posting the solution to my problem. There were some access rules set in the function app which were blocking the traffic. Because of that the POST request to register the subscription was blocked and the the handshake process was failing.
Steps to configure Azure Blob Trigger in Event Subscription with WebHook Endpoint Type:
https://<FUNCTION_APP_NAME>.azurewebsites.net/runtime/webhooks/blobs?functionName=<FUNCTION_NAME>&code=<BLOB_EXTENSION_KEY>
You can find the BLOB_EXTENSION_KEY:
Create Event Subscription:
Create the Event Grid Topic to which you want to subscribe and replace the URL.