I have a webhook which is sending me events at the rate of 1000 per second. Is it possible to route these events via Azure API management in place of directly sending it to Azure Event Hubs for ingestion.
Any specific link from Microsoft that confirms it.
1
- You can send the events to Event Hub via APIM by referring to How to log events to Azure Event Hubs in Azure API Management doc.
- Enable system managed identity in APIM and then, grant Azure Event Hubs Data sender RBAC role to APIM identity in event hub instance as shown below.
- I have created a logger with the credentials of APIM managed identity using below Rest API and request body.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}?api-version=2024-06-01-preview
{
"properties": {
"loggerType": "azureEventHub",
"description": "Event Hub logger with system-assigned managed identity",
"credentials": {
"endpointAddress":"<EventHubsNamespace>.servicebus.windows.net",
"identityClientId":"SystemAssigned",
"name":"<EventHubName>"
}
}
}
- Lets say, I am passing the events in request body and would like to send the same events to event hub, then add the below given policy either in operation level or API level.
<policies>
<inbound>
<base />
<log-to-eventhub logger-id="testlogger">
@(context.Request.Body.As<string>(preserveContent: true))
</log-to-eventhub>
</inbound>
</policies>
I am able to send events to event hub successfully via APIM.
Recognized by Microsoft Azure Collective
4