Website maintenance is important for all organisations, both big and small. Regularly maintaining your site will improve performance and provide a safe and secure environment for your visitors. In other situations like deploying new updates to the website, the website will need to be entirely blocked; however, the issue we are facing with the PowerApps portal is how to give the admin user full access so we can smoke test the new features on the live website, while it is still in maintenance mode.
Enabling maintenance mode on a PowerApps portal is straight forward; you can configure everything in the PowerApps Admin center.
That’s where you can enable the maintenance mode for the portal, however, regardless of if you select the Default page or the Custom page, it will completely block the portal for everyone so nobody can have access to the site so do testing.
Let’s forget about the OOTB maintenance configurations, we will build our own maintenance page. Please note that once we build our own custom maintenance page, we do not need to put the new maintenance page URL in the PowerApps Admin Center Enable maintenance mode—in fact, we don’t use that at all.
Web Role: You can create a new web role or use the existing Administrator role. In my case, I created a new Role called MaintenanceAdmin. Make sure to only assign this role to the user who should have access to the Portal during the maintenance mode.
Site Settings: Create a new site setting, Maintenance/IsMaintenance and set the value to True.
Web Template: Create a new Maintenance Web Template. You can put whatever you like to display on this page, this will be your Maintenance webpage. In my case I inserted an image to my page.
Page Template: Create a new Page Template, make sure to UNTICK the ‘Use Website Header and Footer’ as we are going to modify the Header Web Template.
Web Page: Create a new web page for the Maintenance Page.
All the components we just created are for the modifications of the OOTB Header Web Template.
Insert the code below to the Header Web Template
With all those sets, go to your portal Sign-in Page: https://YourPortalURL/SignIn?returnUrl=%2F
Login as the user with the correct role, in my case, it’s the user assigned with the MaintenanceAdmin role, you should have full access to the portal.
Login as the user without the role, no matter if you hard coded the URL, you always see the maintenance mode.
Once you have all this set up, you can Enable/Disable maintenance mode directly in the site settings, simply set the Maintenance/IsMaintenance to true to enable the site settings or set to false to disable the settings.