Listing All Power Apps in an Environment using PowerShell

Loading

Listing all Power Apps in a specific Power Platform environment using PowerShell allows administrators to track applications, manage access, and perform audits efficiently.


Step 1: Install Required PowerShell Modules

Before running PowerShell commands, ensure you have the necessary modules installed:

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

If prompted, press Y to confirm the installation.


Step 2: Authenticate to Power Platform

Log in to Power Platform using an Admin account:

Add-PowerAppsAccount

A Microsoft sign-in window will appear. Log in using your Global Admin or Power Platform Admin credentials.

For service principal authentication (without manual login), use:

$clientId = "your-client-id"
$clientSecret = "your-client-secret"
$tenantId = "your-tenant-id"

$SecureSecret = ConvertTo-SecureString $clientSecret -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($clientId, $SecureSecret)

Connect-AdminPowerAppEnvironment -TenantId $tenantId -Credential $Credential

Step 3: Retrieve Power Platform Environments

To find all available environments and their EnvironmentName:

Get-AdminPowerAppEnvironment | Select-Object DisplayName, EnvironmentName, Location, EnvironmentSku

Identify the EnvironmentName where you want to list the apps.


Step 4: List All Power Apps in an Environment

To list all Power Apps within a specific environment:

$environmentId = "your-environment-id"

Get-AdminPowerApp -EnvironmentName $environmentId | Select-Object DisplayName, AppName, CreatedTime, LastModifiedTime

This command will display:

  • DisplayName – The user-friendly name of the app
  • AppName – The unique identifier for the app
  • CreatedTime – When the app was created
  • LastModifiedTime – The last modification date

Step 5: Export Power Apps List to a CSV File (Optional)

For documentation or auditing purposes, you can save the results to a CSV file:

$exportPath = "C:\PowerPlatform\PowerAppsList.csv"

Get-AdminPowerApp -EnvironmentName $environmentId |
Select-Object DisplayName, AppName, CreatedTime, LastModifiedTime |
Export-Csv -Path $exportPath -NoTypeInformation

Navigate to C:\PowerPlatform to find the exported file.


Step 6: Disconnect from Power Platform

Once done, disconnect from the session:

Disconnect-PowerAppsAccount

Leave a Reply

Your email address will not be published. Required fields are marked *