Protecting Admin Screens in Power Apps

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

1 Define Admins

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"]);
2 Set Up App.OnStart Logic

Now go to the App object and open the OnStart property. Add this code:

Set(CurrentUser, User());
Set(IsAdmin, CurrentUser.Email in AdminUsers);

app onstart

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

3 Protect the Admin Screen

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.

redirect

4 Show/Hide Admin-Only Controls

Want to show certain buttons, menus, or forms only to admins?

Just set the Visible property of that control like this:

Visible = IsAdmin

admin only controls

Pro Tip: If you go to variables pane, you can see all the variables there

5 Test It!
  1. Save and reload your app

  2. Log in with an admin account — you should access everything

  3. 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.

© 2025, Attosol Private Ltd. All Rights Reserved.