To lock portal behind authentication can be handy for when you are developing the portal before launch and is a way to hide your portal from the world.
Permission control in Portals Design Studio
Open Portals Design Studio from make.powerapps.com by clicking “Edit” on your portals app, From the home page open the “Permissions” section in the right panel. Set the “Page available to everyone” toggle to off. Open the “Pages” menu from the left side to verify that all pages on your portal now have the lock symbol.
Only the contacts with the selected web roles will have access to your portal.
Make sure the other pages in the portal inherit the parent permissions.
This is a quick way to lock your portal behind authentication. Now – there is a way to get it done using the good old Portal Management App too.
User Web Page Access Control Rule in Portals Management App
There is a simple setting called “Web Page Access Control Rule” that enable a redirect for any URL to the login page, and you can manage it from the good old Portals Management App.
Restrict Read for All Content
Create a Web page Access Control Rule for the Home page that Restrict Read for All Content to only Authenticated Users.
Refresh the cache and try getting to the portal root page in a new browser window. No matter what URL you try the portal will automatically reload to the sign in page.
Exclude direct child web links
Now – that doesn’t look quite right. The reason is that we also put all web files out of reach to unauthenticated users. We can fix this with one simple change to our Web Page Access Control Rule: Set the Scope to “Exclude direct child web files”.
Refresh the cache and try to reach the home page from outside authentication once more.
Tip! Give your portal login page a personal touch. This blog post will show you how to Customize the Sign in and Registration page in Power Apps Portals
I use this approach to make sure my demo partner portal on my Community Plan tenant doesn’t trigger license cost. This portal is for creating blog post like this one and helping out with questions in community and so on. I only log in with local users and lock portal behind authentication so there will be no license cost.
This approach is not meant for production portals or as a way to avoid license cost. Power Apps Portals is a great product that is well worth paying license for.