0

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}");
sir_ask
  • 326
  • 1
  • 4
  • 16

1 Answers1

1

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);
Hury Shen
  • 14,948
  • 1
  • 9
  • 18
  • Thanks.. what a silly silly mistake.. i've already wondered on doing that but did with a different object not the content. I seriosly thought that the parameteres were printed also as properties or so.. but well. Thank you – sir_ask Mar 26 '21 at 07:35