Remove-ConnectionRoleAssignment
PowerApps: Removes a connection role assignment
#Requires -Version 5.1
#Requires -Modules Microsoft.PowerApps.PowerShell
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[pscredential]$PACredential,
[Parameter(Mandatory = $true)]
[string]$ConnectionName,
[Parameter(Mandatory = $true)]
[string]$PrincipalObjectId,
[string]$EnvironmentName,
[string]$ApiVersion
)
Process {
try {
ConnectPowerApps4Creators -PAFCredential $PACredential
$args = @{ ErrorAction = 'Stop'; ConnectionName = $ConnectionName; PrincipalObjectId = $PrincipalObjectId }
if ($PSBoundParameters.ContainsKey('EnvironmentName')) { $args.Add('EnvironmentName', $EnvironmentName) }
if ($PSBoundParameters.ContainsKey('ApiVersion')) { $args.Add('ApiVersion', $ApiVersion) }
Remove-AdminPowerAppConnectionRoleAssignment @args -ErrorAction Stop
[PSCustomObject]@{ Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"; Status = "Success"; Message = "Role assignment removed" }
}
catch { throw }
finally { DisconnectPowerApps4Creators }
}PowerApps credentials for authentication
The connection identifier
The assignee to remove
The connection's environment
API version to call