You may have noticed the limitation of the “Start an Approval” action in a Power Automate Flow not allowing you to select Microsoft 365 or AD Groups in the “Assigned To” field so that multiple people can take on the approval task.
This post will guide you through enabling Power Automate content approval Flows in a SharePoint Online Pages Library and assigning approval tasks to users in an Azure AD Group. We have done this using the “Valo Intranet” digital workplace solution software, but this solution works for SharePoint Online out-of-the-box as well!
1. First, we are going to enable page approval in “Site Pages” library. To do that, go to the Site Pages library, Click on Automate -> Power Automate -> Configure page approval flow.
2. On the right corner of your browser, you will notice a tab appear. Click on “Create flow” to continue the wizard.
3. The wizard will automatically create the necessary connections for the flow. Click on “Continue” to create these connections.
Note: By default, these connections will use current user’s credentials to connect. It is recommended you go ahead and change these connections to use a service account.
4. In this next step, give your flow an appropriate name (e.g. “Intranet Page Approval”). In the “Approvers” section, if you try to select an AD group it will not allow you. So, let’s just select any user as a temporary approver. Don’t worry, we are going to change it later. For now, Just set a temporary user as an Approver. Click “Create” to create the flow.
5. Now if you login to https://flow.microsoft.com you should find the newly created flow in “My Flows” section. Click on the flow and open it.
6. We need to modify the flow to set members of an AD Group to receive the approval task, I have an AD group called “Valo Approvers” and am going to assign the approval task to all the members of this group. Click on Edit.
7. The first step (“For a selected item”) of the flow is the trigger, Add a new step after this step.
8. In this step we are going to initialize a string variable to store the approvers in this variable separated by “;”. Select “Initial Variable” in the action.
9. Set the variable name to “Approvers”, Type as a String and leave the Value Blank.
10. In the next step we are going to fetch the members our Valo Approvers AD group and store them in the variable that we just initialized. To keep the flow tidy we are going to define add all these related actions in a Scope. Note, I have kept the “Initialize Variable” action out of the scope so that we can access this variable anywhere in the flow. Let’s add a new Scope, by adding a new action after the “Initialize Variable” step.
11. Inside of this newly added scope, Add new action and select “Get group members” in Azure AD. Note: if you have not used Azure AD action before, you will have to provide the credentials that has read/write access in Azure AD. If you do not have this credential, you can ask your tenant administrator to create a new connection for you.
12. In this action, you will have to provide the Object Id of the “Valo Approvers” group. If you have access to Azure AD, you can find the Object Id by opening the group. If you do not have access, ask your Azure AD administrator to provide you the Object Id. Once you have the Object Id of the group enter it in “Group Id” field.
13. Next we are going to add a loop. Add a new action and select “Apply to each”.
14. In this action, select “Group Members” in the input.
15. Now add a new action inside of “Apply to each” and select “Append to string variable”.
16. Select the “Approvers” variable that we initialized in first step and in value select “Group Members Mail” and add “;” in the end.
17. Below is the exact formula that you want to enter. In the end your screen should look like as shown below:
18. Now, that we have all the approvers stored in “Approvers” variable, the last thing left is to set this variable in “Assigned to” field. To do this, Expand the Scope 2. Find the action that says, “Start an Approval” and change the “Assigned to” value to “Approvers” variable.
19. Your final workflow should look like this with the highlighted section shows the new steps that we added. Save the workflow and test it out to make sure it’s running fine.
Posted by: Imran Patel & Noorez Khamis