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
Environment Maker, Share
Can this script limit be used to limit the default environment ?