Learn how to enforce MFA policies in Microsoft 365 that apply only to unmanaged devices - enhancing security, minimizing login disruptions, and protecting sensitive data in BYOD and hybrid work environments.
PowerApps is one of the constituents of the Microsoft Power platform and is used for multiple functionalities and most of the time while working with the sensitive data stored in the company’s SharePoint site, which is not meant for all the users in the organization and a strong approach is to be needed to hide this data from those users.
One should plan the role-based security to maintain and check which data needs to be available and which role, making PowerApps app development easier.
Let's assume we have an organization where an employee wants to apply for a leave, he submits a request in a PowerApps app which creates an entry in the SharePoint list after which the manager then approves or rejects the request.
The key requirement is that we don't want users to access the approvals page. Only approvers can access the records and make a decision on them.
To achieve this, we can add a condition that says if the current user is a member, then don’t show the ‘Approvals’ button. If the user is an Approver, then show the button.
Let’s define the users’ roles:
To manage the security, the first thing required is when a user uses this app, we need to know what security role has been assigned to him.
Once we have this information, we can add the conditions stating: if the user is a manager, then show the approval button.
To achieve this, we need a way to store the roles of users (defined in the above section) and retrieve that information in the PowerApps App.
Look at the below screens:
Not only do we need to save the role definitions somewhere, but we also need to map these roles to individual users. To provide this functionality in canvas PowerApps, we can introduce an additional screen and add a gear icon (settings icon) on the top right of the home screen to navigate to this screen.
In our current scenario, the following are the business rules we are applying.
As we see in the below screens, Admins have an extra tab to access, and Managers don’t. We will hide the Gear Icon for the members on the home screen as they will not be having access to this screen.
We have outlined the best three ways that we think are beneficial for different use cases and keep the operations and maintenance relatively low in the long run.
We will be discussing the following three ways as listed below:
Before taking our next step, you should know how to create a basic SharePoint list and add custom columns to it. If you already understand how to do this step, you can skip the next section and move on to Using multiple SharePoint Lists (anchor tag).
The primary concept behind this approach involves utilizing a SharePoint List to store user information associated with specific roles. When the app is loaded, the data from this list will be retrieved, and a search will be conducted to identify whether the current user's details are found within it. The presence of such details signifies that the current user holds the corresponding role. We will create a Role management screen to add or remove members from the Groups.
For our scenario, we will create three lists for Member, Manager, and Admin.
To begin with, we will create a list for each role. You can follow the above-mentioned steps for list creation (How to Create SharePoint Lists).
As shown in the above image, we need to create four columns (How to add Columns to SharePoint List) with the following titles and details:
Now from the previous steps, we have identified the role of the currently logged-in user. We should be able to manage the roles from the app itself. We will create a Navigation screen with three buttons that will navigate us to the Role Management Screen of the selected role.
Once you are on the role management Screen,
Patch(
'Admin Users',
Defaults(‘Role SharePoint List'),
{Title: First(‘Your Combo box’. SelectedItems).DisplayName},
{
'Member User': {
'@odata.type': "#Microsoft.Azure.Connectors .SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(First(ComboBox1. SelectedItems).Mail),
Department: "",
DisplayName: First(‘Your Combo box’. SelectedItems).DisplayName,
Email: First(‘Your Combo box’. SelectedItems).Mail,
JobTitle: "",
Picture: ""
}
},
{Email: First(‘Your Combo box’. SelectedItems).Mail},
{UPN: First(‘Your Combo box’. SelectedItems).UserPrincipalName}
)
The above code contains a patch function that creates a new record by taking the data from the Combo box that we created.
Patch(
'Admin Users',
Defaults(‘Role SharePoint List'),
{Title: First(‘Your Combo box’.SelectedItems).DisplayName},
{
'Member User': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(First(ComboBox1.SelectedItems).Mail),
Department: "",
DisplayName: First(‘Your Combo box’.SelectedItems).DisplayName,
Email: First(‘Your Combo box’.SelectedItems).Mail,
JobTitle: "",
Picture: ""
}
},
{Email: First(‘Your Combo box’.SelectedItems).Mail},
{UPN: First(‘Your Combo box’.SelectedItems).UserPrincipalName}
)
The above code contains a patch function that creates a new record by taking the data from the Combo box that we created.
By using multiple SharePoint lists, we can effectively manage user roles and permissions. However, there are other methods that can also be beneficial depending on the specific requirements of your organization. Continue to Part 2 to explore how to use SharePoint Groups to manage security roles in PowerApps.
Learn how to enforce MFA policies in Microsoft 365 that apply only to unmanaged devices - enhancing security, minimizing login disruptions, and protecting sensitive data in BYOD and hybrid work environments.
Learn how to enforce session timeout policies in Microsoft 365 to protect sensitive data, reduce unauthorized access, and secure web apps across all devices — especially in hybrid and remote work environments.
Learn how to stop sensitive files from being downloaded on mobile devices using Microsoft 365 tools like Conditional Access, Sensitivity Labels, and Defender for Cloud Apps. Step-by-step guide with real-world scenarios, compliance tips, and admin checklists.