Protecting Admin Screens in Power Apps


- Getting started with Microsoft Power Platform
- Understanding the Panes in Power Apps: A Beginner-Friendly Guide
- PowerApps: Global Variables, Context Variables and Collections
- Building an Expense App with PowerApps and SharePoint
- Gallery and DataTable
- Navigation, add, update & delete
- Custom Components & Component Libraries
- Building a Smarter Expense App: Direct Email Approvals without Flow
- Protecting Admin Screens in Power Apps (current)
- Publish your App
Protecting Admin Screens in Power Apps Using App OnStart
When building apps in Power Apps, sometimes you need to limit access to certain screens — like an admin dashboard or settings panel. You don’t want every user peeking behind the curtain, right?
That’s where combining the App.OnStart property with a protected screen logic comes in. In this post, we’ll show you how to:
-
Use
App.OnStart
to detect the current user -
Check if the user is an admin
-
Control access to admin-only screens and components
Start by defining who your admin users are. You can store them:
-
In a hardcoded list
-
In a SharePoint list
-
In a Dataverse table
-
Or pull from an Azure AD group
For simplicity, here’s how to hardcode a list of admin email addresses:
Select App
from Tree view
on left side panel. Go to properties list, select onStart
. Now go to formula bar and define global variable for admins.
Set(AdminUsers, ["admin1@yourcompany.com", "admin2@yourcompany.com"]);
Now go to the App object and open the OnStart property. Add this code:
Set(CurrentUser, User()); Set(IsAdmin, CurrentUser.Email in AdminUsers);
What this does:
-
Stores the current user in CurrentUser
-
Checks if the user’s email exists in the admin list
-
Stores the result (true/false) in a variable called IsAdmin
Go to the button that navigates to admin screen. select onSelect property. write logic to navigate to admin screen only if admin.
If(IsAdmin, Navigate(AdminScreen))
This will navigate only admins to the admin screen.
Want to show certain buttons, menus, or forms only to admins?
Just set the Visible
property of that control like this:
Visible = IsAdmin
Pro Tip: If you go to variables pane, you can see all the variables there
-
Save and reload your app
-
Log in with an admin account — you should access everything
-
Log in with a non-admin account — you’ll get redirected from the admin screen
Everything should work smoothly!
Feature | What it does |
---|---|
App.OnStart | Initializes user info and sets IsAdmin |
OnVisible | Redirects non-admins from protected screens |
Visible | Hides/shows controls based on role |
This is a simple and powerful way to restrict access and keep sensitive screens protected in Power Apps.
Conclusion
Securing your Power Apps with role-based logic isn’t just a nice-to-have — it’s essential for building trustworthy business solutions. With just a few lines of Power Fx in the App.OnStart
and a smart use of variables like IsAdmin
, you can confidently restrict access to sensitive screens and controls. This is a very simplistic approach, so use it with caution.
This approach keeps your admin panels hidden from regular users while still keeping your app fast, dynamic, and easy to manage. And as your user base grows, you can expand this logic using SharePoint lists, Dataverse tables, or Azure AD groups to manage roles more flexibly.
Start small, protect what matters, and scale with confidence.