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 1
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.
Within Azure I go through the App registration process.
Create new group alert using Power Automate 4
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 5
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 6
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 7
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 8
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 9
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.
Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like.
I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide.
For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions.
SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/
Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/
You can contact me using contact@sharepains.com
Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like.
I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide.
For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions.
SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/
Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/
You can contact me using contact@sharepains.com
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…
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…