Removing SP App Principals through PowerShell

Door Jan Steenbeek In SharePoint

PowerShell support for SharePoint Add-ins is very minimal. A limitation I ran into today is that you can use PowerShell to register an App Principal, or to retrieve one, but deleting the principal is not possible.

Luckily, Anand Srinivasan already blogged on how to achieve this through .Net code:
link

I’ve taken the liberty to update his sample to PowerShell code, since that fits my usage scenario’s better;

$site = get-spweb “https://spsiteurl.local” 
$clientId = “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”
$manager = [Microsoft.SharePoint.SPAppPrincipalManager]::GetManager($site)
$realm = Get-SPAuthenticationRealm -ServiceContext $site.Site
$nameIdentifier = $clientId + ‘@’ + $realm
$appPrincipal = Get-SPAppPrincipal -Site $site -NameIdentifier $nameIdentifier
$manager.DeleteAppPrincipal($appPrincipal)

Meer informatie

jan-steenbeek-142×142

Jan Steenbeek

SharePoint Architect

+31 6 22 98 69 52 Stuur Jan een e-mail

Reacties

Er zijn nog geen reacties op dit bericht.

Plaats een reactie

Dit veld is verplicht.

Vul een geldig e-mailadres in.

Dit veld is verplicht.