Table of Contents
Graph-based Service Communications API is now the Route to Service Health Data
In January 2021, I wrote about how to use the Office 365 Service Communications API to programmatically retrieve the service health information that’s available in the Microsoft 365 admin center (Figure 1).
At the time, the API used the manage.office.com endpoint. In December 2021, Microsoft deprecated the manage.office.com endpoint and introduced the Service Communications Graph API as the replacement. In this article, I explain how to use the API with Microsoft Graph PowerShell SDK cmdlets to retrieve service health information.
Retrieving Service Health Data
As shown in Figure 1, the active items Microsoft is working on are those that impact the service in some way, usually by removing the ability of users to do something. To find these items, run the Get-MgServiceAnnouncementIssue cmdlet and filter for items classified as advisory with a status of ‘serviceDegration’:
[array]$ServiceHealthItems = Get-MgServiceAnnouncementIssue -All ` -Filter "classification eq 'Advisory' and status eq 'serviceDegradation'" | ` Sort-Object {$_.LastModifiedDateTime -as [datetime]} -Descending $ServiceHealthItems | Format-Table Id, Title, FeatureGroup, LastModifiedDateTime
If you don’t filter the service health items, the Get-MgServiceAnnouncementIssue cmdlet, including those where Microsoft resolved the issue (as with many SDK cmdlets, the All switch tells the cmdlet to fetch everything). This data reveals the areas where most issues occur. In my tenant, the 346 available issues broke down as follows:
$Data = Get-MgServiceAnnouncementIssue -All $Data | Group-Object FeatureGroup -Noelement | Sort-Object Count -Descending | Format-Table Name, Count -AutoSize Name Count ---- ----- Teams Components 80 Administration 39 E-Mail and calendar access 27 SharePoint Features 25 Portal 23 Management and Provisioning 22 Microsoft Defender for Endpoint 21 Cloud App Security 13 Viva Engage 10
Another interesting grouping is by service:
$Data | Group-Object Service -Noelement | Sort-Object Count -Descending | Format-Table Name, Count -AutoSize Name Count ---- ----- Microsoft Teams 80 Microsoft 365 suite 64 Exchange Online 60 Microsoft Defender XDR 32 SharePoint Online 30 Microsoft Defender for Cloud Apps 25 Microsoft Viva 12 OneDrive for Business 8
The start date for the oldest issue was March 1, 2023. The oldest last modified date for an issue was July 31, 2023. This suggests that Microsoft might keep about six months of service issue data online. Your mileage might vary.
Fetching Overall Service Health Data
Underneath the advisory items, the Microsoft 365 admin center displays an overview showing the health for individual services like Exchange Online, Teams, SharePoint Online, and so on. This information is accessible by running the Get-MgServiceAnnouncementHealthOverview cmdlet. In my tenant, this generates a list of 32 individual services, some of which (like Sway and Microsoft Managed Desktop), I’m not interested in. I therefore amend the output by filtering the services that I consider most important:
[array]$ImportantServices = "Exchange", "Teams", "SharePoint", "OrgLiveID", "Planner", "microsoftteams", "O365Client", "OneDriveForBusiness" [array]$ImportantServiceStatus = Get-MgServiceAnnouncementHealthOverview | Where-Object {$_.Id -in $ImportantServices} $ImportantServiceStatus | Sort-Object Service | Format-Table Service, Status -AutoSize Service Status ------- ------ Exchange Online serviceDegradation Microsoft 365 apps serviceOperational Microsoft Entra serviceOperational Microsoft Teams serviceDegradation Planner serviceOperational SharePoint Online serviceDegradation
Using Service Health Data to Highlight Current Advisories
Many people will be perfectly happy to access service health information via the Microsoft 365 admin center. The advantage of using an API to retrieve the same information is that you can then use it in whatever way you think appropriate. As a working example to demonstrate what’s possible, I wrote a script that can run interactively or as an Azure Automation runbook using a managed identity.
The script retrieves the open service health advisories and creates an email with an HTML-format report containing the service data that is sent to nominated recipients (any mixture of mail-enabled objects, including individual mailboxes, distribution lists, and Microsoft 365 groups). The idea is to keep the recipients updated about progress with open issues that Microsoft is working on. Figure 2 shows an example email generated using the service advisories published in my tenant.
After it’s extracted, the report can be disseminated in other ways. For instance, you could publish it as a Teams channel message.
You can download the script from GitHub.
Disrupted Change
Changing the details of an API is always disruptive. It’s not just the new endpoint. It’s also the way that the API returns data. Everything must be checked and verified. At least now the Service Communications API is part of the Microsoft Graph. As such, the level of change should be minimal in the future and we have the added benefit of PowerShell cmdlets to work with.
Learn how to exploit the data available to Microsoft 365 tenant administrators through the Office 365 for IT Pros eBook. We love figuring out how things work.