Remove-MsolServicePrincipal

Removes a service principal from Azure Active Directory.

Syntax

Remove-MsolServicePrincipal
      -ObjectId <Guid>
      [-TenantId <Guid>]
      [<CommonParameters>]
Remove-MsolServicePrincipal
      -AppPrincipalId <Guid>
      [-TenantId <Guid>]
      [<CommonParameters>]
Remove-MsolServicePrincipal
      -ServicePrincipalName <String>
      [-TenantId <Guid>]
      [<CommonParameters>]

Description

The Remove-MsolServicePrincipal cmdlet removes a service principal from Azure Active Directory.

Examples

Example 1: Remove a service principal

PS C:\> Remove-MsolServicePrincipal -ServicePrincipalName "MyApp/myApp.com"

This command removes a service principal by specifying one of its service principal names. In this example, the service principal associated with the service principal name MyApp/myApp.com is removed.

Parameters

-AppPrincipalId

Specifies the unique application ID of the service principal to remove.

Type:Guid
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ObjectId

Specifies the unique object ID of the service principal to remove.

Type:Guid
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ServicePrincipalName

Specifies the name of the service principal or service principals to remove. An SPN must use one of the following formats:

  • appName
  • appName/hostname
  • a valid URL

AppName represents the name of the application and hostname represents the URI authority for the application.

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

-TenantId

Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False