Skip to content

Get-FlowOwnerRole

PowerApps: Retrieves flow owner roles

#Requires -Version 5.1
#Requires -Modules Microsoft.PowerApps.PowerShell

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [pscredential]$PACredential,

    [string]$FlowName,
    [string]$EnvironmentName,
    [string]$PrincipalObjectId,
    [string]$ApiVersion
)

Process {
    try {
        ConnectPowerApps4Creators -PAFCredential $PACredential

        $setArgs = @{ ErrorAction = 'Stop' }

        if ($PSBoundParameters.ContainsKey('FlowName')) { $setArgs.Add('FlowName', $FlowName) }
        if ($PSBoundParameters.ContainsKey('EnvironmentName')) { $setArgs.Add('EnvironmentName', $EnvironmentName) }
        if ($PSBoundParameters.ContainsKey('PrincipalObjectId')) { $setArgs.Add('PrincipalObjectId', $PrincipalObjectId) }
        if ($PSBoundParameters.ContainsKey('ApiVersion')) { $setArgs.Add('ApiVersion', $ApiVersion) }

        $result = Get-FlowOwnerRole @setArgs -ErrorAction Stop | Select-Object *

        if ($null -ne $result) {
            foreach ($item in $result) {
                $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force
            }
        }
    }
    catch { throw }
    finally { DisconnectPowerApps4Creators }
}

PowerApps credentials for authentication

Specifies the flow ID

The environment of the flow

Principal object ID of the user or security group

API version to call

An interactive directory of PowerShell scripts.