I'm trying to send Azure Monitor alerts to an Azure function for further processing.
I have set up an alert that has an action group with two targets: email and a function. Currently the function does nothing except log the event it receives.
When the alert is triggered, I get an email with details of the alert. The function is also called via HttpTrigger, but it merely receives an empty GET request to the URL of the function. The request does not have any information of the alert.
However, if I go edit my action group, there is a button "Test action group (preview)". If I send a metric alert sample, my function receives a POST request with information of the sample alert in the body. How can I receive similar POST from my real alerts?
In the action group actions, I am using the common alert schema. I have tried both "Azure function" and "Webhook" action types, and they both send an empty GET request to the function URL I specify. I have specified the code query param with the function key, and if I add some other static query params to the URL, I can see those in the function.
Here's the function.json:
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
}
For what it's worth, I'm using Terraform but the same issue persists even when I configure the connections manually from the Web UI.