In this blog post, we will show you how to find your organization’s default Power Platform environment using PowerShell.
Before starting, ensure that you have the following:
- PowerShell 5.1 or later installed on your computer.
- The Power Platform PowerShell modules are installed. You can install them by running the following commands in PowerShell:
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
Find the Default Power Platform Environment
First, log in to the Power Platform using the following cmdlet
Add-PowerAppsAccount
To find the default environment run the following cmdlet.
$environments = Get-AdminPowerAppEnvironment
$defaultEnvironment = $environments | Where-Object { $_.IsDefault -eq $true }
$defaultEnvironment
This script retrieves a list of environments using the Get-AdminPowerAppEnvironment
cmdlet and filters the list using the Where-Object
cmdlet to find the environment with the “IsDefault” property set to “True.” The default environment details are then displayed in the output.