Remove-EntraServicePrincipalOwner

Removes an owner from a service principal.

Syntax

Remove-EntraServicePrincipalOwner
      -OwnerId <String>
      -ServicePrincipalId <String>
      [<CommonParameters>]

Description

The Remove-EntraServicePrincipalOwner cmdlet removes an owner from a service principal in Microsoft Entra ID.

Examples

Example 1: Removes an owner from a service principal

Connect-Entra -Scopes 'Application.ReadWrite.All'
$servicePrincipal = Get-EntraServicePrincipal -Filter "displayName eq 'Helpdesk Application'"
$ownership = Get-EntraServicePrincipalOwner -ServicePrincipalId $servicePrincipal.Id | Select-Object Id, userPrincipalName, DisplayName, '@odata.type'
$owner = $ownership | Where-Object {$_.userPrincipalName -eq 'SawyerM@Contoso.com' }
Remove-EntraServicePrincipalOwner -ServicePrincipalId $servicePrincipal.Id -OwnerId $owner.Id

This example demonstrates how to remove an owner from a service principal in Microsoft Entra ID.

  • -ServicePrincipalId parameter specifies the service principal Id.
  • -OwnerId parameter specifies the service principal owner Id.

Parameters

-OwnerId

Specifies the ID of the owner.

Type:System.String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ServicePrincipalId

Specifies the ID of a service principal.

Type:System.String
Aliases:ObjectId
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False