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.
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.
Azure Security Group: Steps are as follows
1: To create a new azure security group, go to “Azure Active Directory.”

2: Select Groups.

3: Select “New Group”.

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

5: Now go to the created security group and copy the “Object Id”, which we will use in 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));

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.

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.
=====
Read more