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:
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:
Then in the left hand side of the filter
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.
One thought on “Create new group alert using Power Automate”
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…