Search code examples
azureazure-api-managementazure-alerts

How do I specify an alert rule for Azure API management for only a specific API?


I have set up an alert rule in Azure that warns us when the backend returns an error code (4xx or 5xx).

This works but the API Management contains a multitude of APIs.

I thought I would create separate alert rules for each API but there does not seem to be a way to do this via UI. Specifically, there is no condition available that would let me select one or more APIs.

Is there a way to do this programmatically via an ARM template or have I missed anything?


Solution

  • Enable Diagnostic Logging to Log Analytics and then create an alert based on a query you write

    https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-use-azure-monitor#resource-logs

    https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-unified-log