Microsoft 365 Group membership approval

This is a write-up of something I demonstrated earlier today. In this article I will share how you can use Power Automate to create a membership approval process for Microsoft 365 Groups owners.

Inspiration

This question from QduBruyn:

I’d like to see if I can use Power Automate to automate the process of adding a user to a group after the group owner approves it.

Power Users Community thread: Automate M365 group membership.

Microsoft Forms

Like suggested in the thread we want to start this process with a registration form. In this example I used Microsoft Forms. A user has to be logged on and can submit a request to join a Microsoft 365 Group.

powerusers_microsoftforms

Approval Centre

After submitting a response the flow will try and retrieve the correct group and send an approval to the owner. This owner could approve (or reject) this request via the Approval Centre.

approval_membership

Flow setup

powerusers_membership_approval

1. Add a When a new response is submitted trigger action. Select your Form.

askapproval

2. Add a Get response details action. Select your Form. Make sure you also select the Response Id dynamic content field.

askapproval02

3. Add Get user profile (V2) action. Use the Responders’ Email in the User field.
This action will retrieve the details of the user who submitted the form.

getuserprofile_respondersmail

4. Add a Send an HTTP request (Office 365 Group connector) action. Make sure you use the GET method and the URI from the code snippet below. Also make sure you replace the question by the question from your Form.
This action is to retrieve the specific Microsoft 365 Group.

sendanhttprequest_groupsfilter

5. Add a Condition action. Check if the length of the value property is not equal to zero. If that is the case your HTTP request has found a matching Group. Use the expression below for that length check.
This action is to check if the Microsoft 365 Group exists.

lengthvalue_notequaltozero

6. Add a Start and wait for an approval action within the Condition – If yes section. Select an Approval type, in this example First to respond. Set a Title, I reused the Display Name and the Group Name. Use the expression below in the Assigned To field.

startandwaitforapproval02

7. Add a second Condition action within the Condition – If yes section. Use the Outcome field and check if it is equal to Approve.
This action is to check if the owner approved the request.

outcome_approve

8. Add a Add member to group action within the second Condition – If yes section. Use the Reponders’ Email for the User Principal Name. Use the expression below for the Group Id.

outcome_approved_addmember

That should be it for the setup.

When you test it you should see the new member be listed in the Group (after approval) like below.

add_membership

Happy testing!

You may also like...

Leave a Reply

Your email address will not be published.

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