alert

Do you want to know when a new group has been created with for example Microsoft Teams? How do you create a new group alert?

Create a new flow

Ideally we would want a flow to trigger on the creation of a new group. But there is now trigger nor there is an action to list all groups.

Create new group alert using Power Automate Microsoft Power Automate Office 365 Groups

The closest thing available is an action that lists my groups.

We need a better solution. Keep reading!

In my flow I’m going to start with trigger that schedules the flow to run every hour. If you need the alerts to come in quicker then simply adjust the schedule and the filter later on in this post.

Create new group alert using Power Automate Microsoft Power Automate Create new Sceheduled flow

Configure an App registration

Like with my posts about Excel and Microsoft Graph, I’m using an Azure App Registration to look after the access to Microsoft Graph end points.

Create new group alert using Power Automate Microsoft Power Automate App Registration

Within Azure I go through the App registration process.

Create new group alert using Power Automate Microsoft Power Automate Register an App

Then the important part, the Group.Read.All scope is selected and once selected the Grant admin consent is completed.

Create new group alert using Power Automate Microsoft Power Automate Group.Read .All Permissions

now we are ready to build our flow.

I’ve created 3 compose boxes again, to hold my Secret, Tenant ID and Client ID, that can be collected form my application registration in Azure.

Create new group alert using Power Automate Microsoft Power Automate Get Access Token part of flow

Then to make my job easier, I’m extracting the access token from the HTTP request using the following expression:

body('HTTP')?['access_token']
Create new group alert using Power Automate Microsoft Power Automate Get Access Token out of HTTP request

Then the next HTTP request to the MS Graph endpoint that gives me all the groups. In this call you should consider filtering just the latest groups that have been created, however for this post I’m going for the easier to configure approach.

I’m going to use a filter action.

Create new group alert using Power Automate Microsoft Power Automate Get all the groups

In the following filter I’m using the following expression in the From:

body('HTTP_2')?['value']

Then in the left hand side of the filter

item()?['createdDateTime']

And on the right hand side using the formatDateTime function, I’m selecting the recently created groups.

formatDateTime(addHours(utcNow(), -1), 's')
Create new group alert using Power Automate Microsoft Power Automate filter out the new groups

Now I will have an array of new groups. Note that if you want to run the alerts more frequently you will have to adjust the code in the above filter.

New Group Alert emails

Now the final step is to send out new group alert emails to the people who need to know.

New group Alert Emails

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

One thought on “Create new group alert using Power Automate”
  1. Are you able to send me the flow as a file that can be imported? I can’t seem to get the access_token dynamic content from the HTTP module… Other than that I could make it work…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: