How to block all users in a tenant from accessing a canvas app/ model driven app in PowerApps?

As of the time of writing this blog, this is a preview feature. But I am quite confident that such a useful feature shall make it to production.

You have a canvas app which is widely used across your organization. You are about to make a major release of the app. But this time you want to put a downtime notification during deployment window and once everything is fine, you shall make the app up and running again.

During the downtime window, any user trying to access the app should be barred from using it. How do you plan to do it? The app is shared with significant number of users in your organization. You might say – I can unshare the APP and then share it back once deployment is done.

Well it might work when your app is accessed by handful of users. But certainly not a viable solution if your app have a significant user base.

Well this is just one of the many scenarios. There can be a scenario where your app is no longer valid. You don’t want to delete the app but want to make sure no user can access the APP. And countless of similar scenarios where you might find this useful.

Here in comes the wonderful preview feature. Now you can quarantine an app. And when you quarantine it, any user trying to access the app shall be presented with a maintenance notification.

So let’s get started. As of the time of writing this blog, this can only be done through Power Shell. Let’s see the steps.

Step 1 : Install necessary Power Shell Modules

Open Powershell as administrator and install the below module.

Install-Module Microsoft.PowerApps.Administration.PowerShell

Please note that you might already have the module installed. In that case we would need to forceinstall the module using the following command

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force

Once the module is installed successfully, follow Step 2 to connect to your Power Apps environment.

Step 2: Connect to your Power Apps Environment

Run the following command to connect to your Power Apps environment.

Add-PowerAppsAccount

You will get a popup to enter the username and credentials. Complete your connection to Power Apps environment.

Step 3: Quarantine your APP

Now it’s time to quarantine the APP. For that there is a new command Set-AppsAsQuarantined

The command take couple of parameters

  • EnvironmentName : The Unique Identifier of the environment.
  • AppName: The unique identifier of the APP that you want to quarantine.

Below is the command with the parameters.

Set-AppAsQuarantined -EnvironmentName 4f534ade-a98f-44c6-82fc-ae8a024a9a26 -AppName d5243287-f80b-4991-b2b4-3ab5ee832147
Quarantined

Just in case you are wondering, how to get the Environment identifier and the APP identifier, you can easily get from the Maker Portal.

Block all users from accessing a Power App Canvas app or Model Driven app.
Application ID

Block all users from accessing a Power App Canvas app or Model Driven app.

Environment ID

If you statement ran successfully, you shall get Quarantined message.

Now is the time to test. I have logged in with a user and try to access the quarantined app.

And below is the message I get.

Block all users from accessing a Power App Canvas app or Model Driven app.

Can this be customized? At the time of writing this blog, the answer is No. But still quite a useful feature nonetheless.

Before I go ahead and finish this blog. How about bringing the app back to live? How about un-quarantining?

Well, you have a command for that too. All you need to to execute the below command.

Set-AppAsUnquarantined -EnvironmentName <EnvironmentName> -AppName <AppName>

Hope this helped!

You might also like the below posts.

Debajit Dutta
Business Solutions MVP

2 thoughts on “How to block all users in a tenant from accessing a canvas app/ model driven app in PowerApps?”

  1. This is fabulous, thanks! Which command or option would you use to “un-quarantine” it after you’ve finished your work? Thanks!

    1. Debajit Dutta (Business Solutions MVP)

      Hi Gail,
      Thanks for reading my blog. Just updated my blog for un-quarantining a quarantined app.

      -Debajit

Comments are closed.