4

I'm using Azure Alerts to use webhooks. I added the webhook in the action group. The URL I used is the one from Slack.

I also added a Notification Type Email. The notification email gets triggered but I am not receiving any message in the Slack channel.

I was able to push messages to the webhooks using postman hence I know my webhook is correct. But Azure Alert is not able to trigger the webhook. I am not receiving any messages in the Slack channel.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
cam
  • 129
  • 1
  • 12

3 Answers3

3

Azure Monitor sends a notification with its own schema definition. Slack doesn't recognize it, so you cannot see any notifications in the channel. It is possible to create a Logic App or Azure Function to transform the default schema.

Here the more information about it: https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-common-schema

  • Turned off the 'alerts-common-schema" via the portal and it still not working. I used the slack webhook. – jtvdw Feb 22 '22 at 22:11
3

Slack expect a json object when using webhooks. When sending directly from azure alert you will get bad request.

Every slack channel has an e-mail adress. You can post messages to the channel using that email in azure alerts

Rambech
  • 73
  • 1
  • 6
  • 2
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 08 '22 at 18:53
1

Anyone looking for using Slack and Azure Alerts. This seems to work fine:

...
  webhook_receiver {
    name                    = "Slack"
    service_uri             = "https://hooks.slack.com/services/secret"
    use_common_alert_schema = false
  }

Then in the scheduled query rules alert:

...
  action {
    action_group           = [data.azurerm_monitor_action_group.actiongroup.id]
    email_subject          = "Disk storage at less than 10%"
    custom_webhook_payload = "{ \"text\" : \"Warning: Storage has less than 10% diskspace remaining!\"}"
  }
Stephan
  • 66
  • 4