cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Retrieving Office 365 Service Health Notices using Microsoft Flow -> Email

Hi everyone, as an addon to this extremely helpful blog post here is how I have managed to fetch the latest Service Health Incident (only) from Office 365 "Office 365 Service Communications API".

 

Credit to both Jon Levesque for the post and Antonio Maio for the content of that post.

 

As any O365 admin will know, Microsoft won't offer an inbuilt alert that will notify you by email when a new Incident arises so here is how I have chosen to get round that and here is a sneak peek of the output:

 

Capture-020.png

 

You may want to save Antionio's work as a Flow, then call that Flow from a new flow which contains my work, but I'll let you look into that on your own and decide how to implement and tailor to suit. For the purpose of this post it is one Flow.

 

Pre-requisite: Read the blog then I will continue on from where Antonio left off.

 

Capture-015.png

  

Here are the required connections:

 

Capture-017.png

 

Here is the complete flow:

 Capture-002.png

 

So once you have got as far as "Get Office 365 messages" you now have a whole stack of JSON data from O365 Service Health & Message Center that you can filter to suit.

 

The following  takes the data, looks for only MessageType "Incident" and with a StartDate of 10 minutes ago or less

 
Capture-004.png

 

1a = body()['Get_Office_365_Messages']

1b = Build schema using "Use sample payload to generate schema" with JSON from previous step.

2a = body('Parse_Subscribed_Services')['Value']

2b = @and(equals(item()?['MessageType'], 'Incident'))

3a = body()['Filter_Array']

3b = @greaterOrEquals(item()?['StartTime'], addminutes(utcnow(), -10))

 

Now, before we create an HTML table we will need to know if the previous request and it's filters have any data.

 

Capture-008.png

 

4 = @not(empty(body('Filter_array_2')))

 

NB: If there is no new incidents in the last 10 minutes this Flow will complete as a success but with no email output.

 

When there has been data returned the following will create an HTML table:

Capture-010.png

 

5a = body()['Filter_Array_2']

5b = item()['WorkloadDisplayName']

5c = item()['Title']

5d = item()['ImpactDescription']

5e = item()['MessageType']

5f = item()['Severity']

5g = item()['Classification']

5h = item()['Id']

5i = formatDateTime(item()['LastUpdatedTime'],'dd-MM-yyyy HH:mm:ss')

5j = formatDateTime(item()['StartTime'],'dd-MM-yyyy HH:mm:ss')

 

Now time to send the email, but I prefer to link an Office 365 Profile first

Capture-012.png

 

And here is what I have added to my HTML Email (See advanced options)

 

Capture-014.png

 

7a = formatDateTime(utcNow(),'dd/MM/yyyy | HH:mm')

7b = body()['Create_HTML_Table']

7c = [Markup Below]

 

<html>
<head>
<style>
table {
border-collapse: collapse;
width: 100%;
text-align: center;
}
td, th {
border: 1px solid #ddd;
padding: 4px;
}
th {
padding-top: 8px;
padding-bottom: 8px;
background-color: #7F7D7E;
color: white;
font-weight: normal;
}
</style>
</head>
<body>
<span style="display:none">
Attention! You have a live O365 Incident. Just Landed! ...
<br/><br/>
</span>
<span>
<img src="#" alt="Text" height="100" width="114">
</span>
<br/><br/>
@{body('Create_HTML_table')}
<br/><br/>
<span>Click <a href="https://admin.microsoft.com/AdminPortal/Home#/servicehealth">here</a> to visit the Service Health Dashboard</span>
</body>
</html>

 

So, to finish this off a subtle change will be required to step 1 of Antonio's Flow for the Recurrence.

 

It is set to run every week on a Monday but my recurrence needs to be every 10 minutes so please change the initial step to match the below.

 

Capture-018.png

 

Clearly, I am from the UK and have set my timezone to suit but please set yours to suit.

Also, there is no need for a Start time but having one means the Flow runs like clock work and delivers data at exactly 9:10am, 9:20am, 9:30am etc.

 

As a foot note, I can spot one or 2 ways that could enhance or improve this Flow. You may be able to also. If you feel you would like to offer an improvement then please do not hesitate to let both myself and the community know by posting below and if you have any questions please ask away and I will do my best to answer.

 

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


3 REPLIES 3
Super User
Super User

Re: Retrieving Office 365 Service Health Notices using Microsoft Flow -> Email

As an aside to this post, another option to 2b (above) would be ...

` 2b = @and(equals(item()?['Status'], 'Service Degradation')) `

 

At present I am trialling using ['Status'] instead of an ['MessageType'] in order to be alerted of issues that cause loss of service for our users. This allows me to pre-empt and notify parties quickly, but the accuracy of the StartTime field when MS post the issue to the dashboard will play a part in this. 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Super User
Super User

Re: Retrieving Office 365 Service Health Notices using Microsoft Flow -> Email

Call Office 365 Service Communications API and Return New Service Health Notices


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Super User
Super User

Re: Retrieving Office 365 Service Health Notices using Microsoft Flow -> Email

Hi @yoshihirok 

I see you mentioned "I want to get the issue of Microsoft products ASAP include Microsoft Flow," here - https://powerusers.microsoft.com/t5/Flow-Ideas/Microsoft-Service-Health/idc-p/257871#M13475

So I thought i'd draw your attention this information ...

Details in this thread or more detailed at this link.

 

If you have found my post helpful, please mark thumbs up.

Any other questions, just ask.

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,577)