Introduction
In this blog, you will see as an administrator how to get all the flows that contain specific characters (for example, test) from a specific environment using PowerShell.
Prerequisites
Install the following modules.
- Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
- Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
PowerShell Script
Open Notepad and paste the following script. Save the file as script.ps1.
- # Input Parameters
- $envDispName='Finance Prod'
-
- # This call opens prompt to collect credentials (Azure Active Directory account and password) used by the commands
- Add-PowerAppsAccount
-
- # Get the specific environment
- $env=Get-AdminPowerAppEnvironment -ErrorAction SilentlyContinue| Where-Object {$_.DisplayName -eq $envDispName}
- $envName=$env.EnvironmentName
-
- # Get all the flows from specific environment which contains the display name as test
- write-host -ForegroundColor Magenta "Getting flows from environment: " $env.DisplayName
- $flows=Get-AdminFlow *test* -EnvironmentName $envName
-
- # Loop through the flows and display teh values
- foreach($flow in $flows)
- {
- write-host -ForegroundColor Green "Flow Name: " $flow.FlowName " Display Name: " $flow.DisplayName " Created Time: " $flow.CreatedTime
- }
Open Windows PowerShell window and navigate to the location where the script file was saved.
Run the following command.
.\script.ps1
Reference
https://docs.microsoft.com/en-us/power-platform/admin/powerapps-powershell#power-automate-commands
Summary
In this blog, you saw how to get all the flows which contain specific characters from a specific environment using PowerShell.