PowerShell – Get the list of all connectors used by each Power Apps application

The PowerShell script will list all connectors used in the Power Apps application in all environments user has access to.

# Required Modules (installed as admin)
#   Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
#   Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
#
$Delimiter = ","
# Get list of all Environments
$Environments = Get-PowerAppEnvironment | Select-Object -Property EnvironmentName, DisplayName 

write-host $Environments

# Loop through all Environments 
foreach ($Environment in $Environments)
{
    # List all Apps in each environments
    $AppNames = Get-PowerApp -EnvironmentName $Environment.EnvironmentName | Select-Object -Property AppName, DisplayName

    # Loop through each app to get connectors it is using
    foreach ($AppName in $AppNames) {
        $Connectors = Get-AdminPowerAppConnectionReferences -EnvironmentName $Environment.EnvironmentName -AppName $AppName.AppName | Select-Object -Property ConnectorName

        # Write outputs
        ForEach ($Connector in $Connectors.ConnectorName) {
            Write-Output ($Environment.DisplayName + $Delimiter + $AppName.DisplayName + $Delimiter + $Connector) 
        }
    }
}

# Outputs in format of 
# Environment, App Name, Connector Names
# Env 1,Booking App,shared_office365users
# Env 1,Booking App,shared_office365
# Env 2,Message App,shared_skypeforbiz




	
No comments yet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress. Designed by WooThemes