Remove-EntraServicePrincipal

Removes a service principal.

Syntax

Remove-EntraServicePrincipal
      -ServicePrincipalId <String>
      [<CommonParameters>]

Description

The Remove-EntraServicePrincipal cmdlet removes a service principal in Microsoft Entra ID.

Examples

Example 1: Removes a service principal

Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy'
$servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Remove-EntraServicePrincipal -ServicePrincipalId $servicePrincipal.ObjectId

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

  • -ServicePrincipalId parameter specifies the service principal Id.

Parameters

-ServicePrincipalId

Specifies the ID of a service principal in Microsoft Entra ID.

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