Home > PowerApps > Power Apps | Sharing | Restrict ‘Everyone in Environment’ option using PowerShell

Power Apps | Sharing | Restrict ‘Everyone in Environment’ option using PowerShell

In Power Apps, by default Users with ‘Environment Maker’ role can create and share the Apps. One of the sharing option is ‘Everyone in Instance’, which grants access to all Users in the Azure tenant.

In one of our requirements, we had to restrict the ‘Share with everyone’ option for the ‘Environment Makers’ and limit to ‘Global Admins’. Lets see how to achieve this in this article.

Scenario:

In my Power Apps account, I got 2 Users.

  • Rajeev – Global Administrator.
  • Jayansh – Environment Maker.

User Jayansh, created an App named ‘Simple App’ and wants to share. By default ‘Everyone in Environment‘ option is enabled.

Lets restrict this option using the following PowerShell commands.

PowerShell script:

  • Open the PowerShell console in ‘Administrator’ mode.
  • Execute Add-PowerAppsAccount command to connect to the Power Apps tenant.
  • Execute following command, to check the current state of ‘Share with everyone’ (i.e., Everyone in Environment) option. It returned ‘False’ in my case, which means ‘Share with everyone’ option is available .
    • $settings = Get-TenantSettings
    • $settings.powerPlatform.powerApps.disableShareWithEveryone
  • Lets turn off the ‘Share with everyone’ option using following command.
    • $settings.powerPlatform.powerApps.disableShareWithEveryone=$true
    • Set-TenantSettings $settings

Try Sharing the App as ‘Environment Maker’

  • Connect to Power Apps portal as User ‘Jayansh’ who is ‘Environment Maker’.
  • Select the App and click ‘Share’. Select the ‘Everyone in MS‘ (MS is my environment name) and click ‘Share’.
  • An exception message will be thrown as below.

Try Sharing the App as ‘Global Administrator’

  • Connect to Power Apps portal as User ‘Rajeev’ who is ‘Global Administrator’.
  • Select the App and share using ‘Everyone in MS‘ option.
  • And the App gets shared successfully.

🙂

Categories: PowerApps Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: