Author Details

avatar-teacher

Evolvous

We are a team of tech enthusiast and this section is where we love to share our experience and our knowledge. We try our best to help you understand technical topics by giving you live instances of how-to’s, guides, tips, FAQ’s and troubleshoots.

If you like it or have questions, do share your feedback in the comments section below.

Role-Based Security in PowerApps

It is a typical scenario where developers have to face a general question: how do I implement role-based access control in my app? Or, simply putting it together, how do I make certain features or screens of my app available only to the authorized people in my organization? Here we will take a simple example using Azure Active Directory and the custom connector feature of Power Apps to explain the process of Role-Based Security in PowerApps.

Let’s discuss your project

Introduction to Role-Based Security in PowerApps Steps

Making certain features or buttons of the Power App available only to the authorized people, using role-based security. Let us take the case where we want to make the admin button available only to the users who belong to a particular security group.

Required Components for Role-Based Security in PowerApps

  • Azure security group
  • Power Apps

Solution:

Azure Security Group: Steps are as follows
 1: To create a new azure security group, go to “Azure Active Directory.”

Role-Based Security in PowerApps - Evolvous

2: Select Groups.

Select groups in power apps - Evolvous

3: Select “New Group”.

New group Role-Based Security in PowerApps - Evolvous

4: Provide the below details to create a new security group and click on “Create”.

      • Group Type: must be “Security”
      • Group Name: provide the name
      • Owners: Add Owners to whom you would like to add
      • Members: Here add the users, to whom you would like to provide the role based access.

Role-Based Security in PowerApps New group - Evolvous

5: Now go to the created security group and copy the “Object Id”, which we will use in PowerApps.

The created security group and copy the “Object Id" - Evolvous

PowerApps:

 1: On app “OnStart,” add the below code. So that it will check whether the currently logged-in user is a member of the created security group or not. If the logged-in user is a member of the security group, then it will set one Boolean variable as accurate. An example here Variable is VarAdmin.

ClearCollect(AdminUsers,Office365Groups.ListGroupMembers(“885bd0a6-4467-445e-8889-b317afd0556c”).value);
If(User().Email in AdminUsers.mail ,Set(VarAdmin,true), Set(VarAdmin, false));

On app “OnStart,” - Evolvous

2: Select the button, then set a visible property as VarAdmin. So that button is visible for the users who will be part of the created security group only.

Select the button, then set a visible property as VarAdmin. So that button is visible for the users who will be part of the created security group only. - Evolvous

3: The same formula will be applicable for labels, particular sections, Fields, etc.

Conclusion

With this tutorial, I aim to give you a good overview of implementing Role-Based Security in PowerApps. I tried to keep the post short and simple to help you understand better. However, let me know your feedback and questions. Will be great if some of you could share your scenario or share additional tutorials you created on similar lines. Contact us to learn more.

Let’s discuss your project

=====

Read more

Power Automate HTTP Request and Response