Get Teams Notifications for Office 365 Service Health Issues

When a backend issue occurs in your Office 365 tenancy, it is flagged by Microsoft in the Service Health Dashboard. Here any issues or degradation of a particular service can be tracked and while there is not much action that can be taken to resolve these issues from a tenant admin perspective, they can be useful to track resolution and to communicate to end users any potential impact.

There are a number of ways to stay on top of this information such as using the built-in notification settings, or by subscribing to particular issues to track updates. Email notifications are fine and get the job done but if you’re anything like me, email is becoming a secondary workspace, Microsoft Teams is where I spend a lot of my time. Surfacing the service health updates within Teams is a pretty nice solution to allow the information to flow to the right people in a timely manner without replying on monitoring mailboxes. This can be done by specifying a Teams Channel email and using the email functionality but I think it can be made even more fluid using some of the tools available to us within Office 365.

Take for instance Power Automate. Using PA to fetch and apply logic to the service health allows would allow us to not only surface these notifications in Teams the way that we want, but also to add on some extra steps such as checking with our Team is the issue is of impact to the organization and even integrate with other Microsoft or third-party apps for some cool functionality.

Using Graph API

This information is available via the Service Communications API however Microsoft have recently made this information available through the Microsoft Graph API and retrieving it is extremely easy. Querying the service health requires the “ServiceHealth.Read.All” Azure AD permissions and a quick test in Graph Explorer allows us to see the dataset returned (Shown in Figure 1).

Figure 1: Testing https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews” in Graph Explorer

This overview is nice and we could use it to flag the high-level status of each service, but we can take this a step further by looking at the “Issues” endpoint. Here we get a list of the issues flagged in the environment, adding in a filter to only show unresolved issues takes out some of the noise and we are left with a nice detailed list shown in Figure 2.

Figure 2: Query open issues using: “https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues?$filter=IsResolved eq false”

This looks like a good dataset to work from, next we need to get this data into Power Automate and posted to Teams.


Retrieve a Graph API Access Token in Power Automate

To authenticate from Power Automate, an application registration is needed. I’ve detailed creating an app reg and granting permissions in the past so check out this article to get that set up. To access the Service Health information, make sure to add the ServiceHealth.Read.All permission and grant consent as shown in Figure 3.

Figure 3: Grant ServiceHealth.Read.All Permissions on the Application Registration

With the App created, generate a Client Secret and take note of the Tenant ID and Client ID as usual. You could store these values in the Flow but for added security I recommend using an Azure Key Vault to store the values (Note: Key Vault is a Premium Connector for Power Automate). For the purpose of this demo I will store the values in the Flow.

In Figure 4, I am using the variables containing the Client ID, Tenant ID and Client Secret to create a request to the Service Health endpoint and return JSON the results to a variable in the Flow.

Figure 4: Create the Graph request and store the results (JSON format)

With the JSON results in a variable, the “Parse JSON” task can be used with an example output to generate the schema. Then it’s just a simple loop to send a notification for each open service issue as shown in Figure 5.

Figure 5: Loop through the issues to post each to Teams.

Teams Notifications

On the Teams side, messages are posted each time the flow runs for any open issues as shown in Figure 6. This gives good high-level visibility of any open issues and with a little bit of work, can be customized to add extra functionality.

Figure 6: Teams messages are posted for any open issues

Summary

This is a pretty simple setup that delivers some handy information through Teams. It can be expanded out to add additional context, issue updates and resolution with a small amount of effort but the instructions here should get you started.

3 thoughts on “Get Teams Notifications for Office 365 Service Health Issues

  1. Joe Halpy

    Thank you for the post, i was able to get this running. The only challenge i have with it is that every 5 minutes it spams to the teams channel with all advisory/incident that are open even if the status of the advisory/incident has not changed.

    I was hoping for it to only send to the channel when there is an actual update to an advisory/incident. Any ideas?

    Like

Leave a comment