We continue from where we left a few days ago

Now we are in the Power Automate Application Here we will use a template close to what we want to do. We will use Send Approval and follow up with an email template. Make sure you have the connections configured. If not, create new connections then click Create Flow

Now, it is the time to customize the flow to make it do what we need, and for that we need to detail what we wanted the application to do:

  • Once the request is created, send a message on Teams to the approver saying there is a request standing in your approval queue
  • create a request for the application install
  • When the request is approved sent an email and get the user Azure Object ID
  • Send a message on Teams to the approval saying we are adding the user to the corresponding Azure group to install the application
  • Add user to the group

Let’s get to work:

  • Click the plus icon standing on the arrow between PowerApps and Start an approval cell to insert a new step
  • Click add an action
  • Look for Teams in search connectors and action search box
  • Look for Post a message as the Flow bot to a user (preview) action
  • In Headline enter Application Approval Request
  • For recipient select ApprovalToEmail from Dynamic content
  • In message box enter Application request from user
  • Now we need to add a new dynamic parameter
  • Click see more in the dynamic content panel
  • Select Ask in PowerApps
  • Now our flow looks like this

Let’s see if the Start an approval action has all the parameters we need. Looks like we need tell the approver what application we need.

  • Click at the end of the text in the Title box and add the following text “ for application ”
  • We request a new parameter from the Power Application.
  • Click see more in the dynamic content window and select Ask in PowerApps

Moving to the condition, we will customize only the “If yes” flow. We have 3 things that we still need to do to complete our flow: send a message to the approver on Teams, get the Azure user Object ID, and add the user to the corresponding group.

  • Click Condition
  • On If yes path click Add an action
  • Look for Azure AD and select it
  • Look for Get user action and select it
  • In the newly created Get user action box we need to pass the user principal name. Fortunately, we already have this parameter because we used it in the first Team message we send
  • Click inside the box, scroll down the dynamic content list on the right until you see the PowerApps parameters
  • Click PostmessageastheFlowbottoauser_message
  • Click Add an action to continue
  • Add a Post a message as the Flow bot on teams – same as we did before
  • In the Headline enter Adding User to Group
  • For recipient select ApprovertoEmail from dynamic content
  • And in the message filed we say: “Adding User with ID
  • Click Id  from dynamic content
  • Continue writing: “to application
  • Then select Startanapproval_Title from dynamic content
  • Click Add an action to continue
  • Click Add an Action
  • Look for Azure AD and select it
  • Look for Add user to group and select it

This action needs 2 parameters: group ID and user Id. We just collected the user Id of the requester and we have the group in the excel table. The only thing remaining is to pass this as a parameter

  • Click Group Id
  • Go to dynamic content and when you get to PowerApps click See more
  • Click Ask in PowerApps request a new parameter
  • Click User Id in the Add user to group action box
  • Select id form get user list in dynamic content

The final part of the flow should look like this

Click Save to create the flow

Connect the Flow to the App

Back to the PowerApps tab, we not have a new flow that will be executed when we click the request button

First let’s make sure we have all the connection we need

  • One Drive (or one drive for business) connection
  • Azure Ad – if not you would need to create one
  • Connection to the flow we just created

In this post we have not renamed any of the objects in the canvas, so they will all come with default names like button1, DataCardValue1 etc.

We need to pass the parameters to the flow when we press the Request button, but fists let’s see that are the parameters we used in the flow and what do they mean

Parameter in AppParameter in FlowValue
DataCardValue1Startanapproval_tileApplication Name
DataCardValue2ApproverToEmailapprover
DataCardValue4Adduserrogroup_GroupIdGroup ID
user.Email()Postamessageastheflowbottoauser_messagerequestor
DataCardValue2ResultFollowUptoEmailfollow up approver

Once we add the parameters correctly associated our function will look like this

If you have any error, you will have to fix it to have a working app

Test the app

In the upper right part of the screen notice that app checker says there are not error and click the preview button

In the app, let’s navigate to Visio and click Request and see what happens :

In the bottom right section of the screen you notice you have a card on Team

Flow just sent you a notification,

Click the Approval tab and notice you have a request waiting.

Click Approve ( or reject 😀 but you will not see the happy ending )

Confirm with an optional Comment

Flow sends you another card, this time saying that user with your user ID has been added to the group

Also, the approval has also been captured on email

The last thing to check is to see if our user has been added to the Visio Group in AAD

Indeed, Visio-Install has a new member. The application has been approved and the user will receive the deployment

In this post we created an automated approval flow for a licensed application request.