I have some alerts that trigger an c# azure function, problem.. i can't get the alert on request body of the AF. Should't i be able to parse the body and check the alert name for instance?
I managed to trigger an logic app and check the content of the alert, but with the AF, is killing me. Thank you in advance for the help.
Here's how i tried to parse the body and always print's nothing.. that's why i'm thinking that is acting different than the logic app trigger.
var content = await new StreamReader(req.Body).ReadToEndAsync();
log.LogInformation($"contentmessage:", content);
string body = await req.ReadAsStringAsync();
log.LogInformation($"bodymessage: {body}", req.Scheme);
dynamic obj = JsonConvert.DeserializeObject(body);
log.LogInformation($"message: {obj.data.context.name}");
For this problem, please change the code in your function from:
log.LogInformation($"contentmessage:", content);
to
log.LogInformation("contentmessage:{$content}", content);
or print the content
directly:
log.LogInformation(content);