Create new group alert using Power Automate

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.

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.

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.

Within Azure I go through the App registration process.

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

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.

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

body('HTTP')?['access_token']

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.

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')

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.

Share
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.

Recent Posts

Filter Query in SharePoint Get Items in Power Automate

Have you tried the experimental version of Filter query in the SharePoint Get Items action…

2 days ago

3 Ways to add a column to an array in Power Automate

When you have an array in Power Automate and you would like to add a…

6 days ago

Patch any field type in a SharePoint list item using Power Apps

In Power Apps the Patch function is very important when you work with data. In…

1 week ago

Call flows from a model driven app

Wouldn't it be great if you could call flows from a model driven app? Well…

2 weeks ago

Variables or Compose? Consider neither in Power Automate

The question is Variables or Compose actions in Power Automate? Variables Sometimes you need a…

2 weeks ago

Your 1st lesson in Power Apps, in a few easy steps!

1st lessons can be so important when you want to get started with Power apps.…

4 weeks ago
%%footer%%