Skip to content

Remove-PnPEntraIDServicePrincipalAssignedAppRole does nothing and throws no error #5342

Description

@kasperbolarsen

Steps to reproduce behavior

I created an Azure Function, enabled system assigned managed identity, noticed the principalid

#Remove-PnPEntraIDServicePrincipalAssignedAppRole test

$SPOAdminUrl = "https://your tenant]-admin.sharepoint.com/"
$principal = "the principalID"
$PnPClientID = "the app id of the PnP Rocks app"
$permissionsConn = Connect-PnPOnline -Interactive -ClientId $PnPClientID -Url $SPOAdminUrl -ReturnConnection

Add-PnPAzureADServicePrincipalAppRole -Principal $principal -AppRole "Sites.FullControl.All" -BuiltInType SharePointOnline -Connection $permissionsConn

#So far it all works fine, the permission is visible in Entra

Remove-PnPEntraIDServicePrincipalAssignedAppRole -Principal $principal -AppRole "Sites.FullControl.All" -Connection $permissionsConn -errorAction Stop

#Nothing happens, the permission is not removed, waited 4-5 minutes

Remove-PnPEntraIDServicePrincipalAssignedAppRole -Principal $principal -Connection $permissionsConn -ErrorAction Stop
#This one works, removes all permissions for said principal

What is the version of the Cmdlet module you are running? 3.2.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions