Modern Alerting: Sending your alerts to Microsoft Teams or Slack with PowerShell

By Bradley Wyatt

Elevator Pitch

Learn how to leverage PowerShell to send all of your infrastructure alerts to Microsoft Teams or Slack where you can collaborate and delegate. Know who on your team is taking care of what. Scrape event logs, send your Azure alerts, environment changes, and and more straight to Slack and Teams.

Description

IT pro’s have traditionally sent their alerting to e-mails which often would get ignored, filtered to some folder, or even caused confusion when you were not sure who was working on which alert. With PowerShell you can send all of your alerting to either Microsoft Teams or Slack by configuring Incoming Webhooks and sending a JSON payload to a specified Teams/Slack channel URL. Using PowerShell you can scrape logs and alerts and show only the data that you find critical.

During this session, we will discuss:

  • Setting up your Webhooks
  • Using Invoke-RestMethod to send to Teams or Salck
  • Utilizing PowerShell Runbooks to send cloud infrastructure alerts
  • PowerShell log parsing and scraping
  • JSON formatting and PowerShell

Notes

I have blogged at TheLazyAdministrator.com several times on how I have configured event log scraping with PowerShell, then used PowerShell to format the data, save as JSON and send over to Microsoft Teams for alerting. I have implemented this at many large firms around Chicago for their IT Teams to lower the amount of emails everyone gets and allow the teams to collaborate on the alerts (delegate, comment on work or even if specific alert can be ignored). I have given 2 talks at Microsoft MTC in downtown Chicago and 1 for the RTPSUG.