Remove-AzADServicePrincipal

Deletes the azure active directory service principal.

Syntax

Remove-AzADServicePrincipal
      -ObjectId <String>
      [-PassThru]
      [-Force]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADServicePrincipal
      -ApplicationId <Guid>
      [-PassThru]
      [-Force]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADServicePrincipal
      -ServicePrincipalName <String>
      [-PassThru]
      [-Force]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADServicePrincipal
      -DisplayName <String>
      [-PassThru]
      [-Force]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADServicePrincipal
      -InputObject <PSADServicePrincipal>
      [-PassThru]
      [-Force]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADServicePrincipal
      -ApplicationObject <PSADApplication>
      [-PassThru]
      [-Force]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Deletes the azure active directory service principal.

Examples

Example 1 - Remove a service principal by object id

PS C:\> Remove-AzADServicePrincipal -ObjectId 61b5d8ea-fdc6-40a2-8d5b-ad447c678d45

Removes the service principal with object id '61b5d8ea-fdc6-40a2-8d5b-ad447c678d45'.

Example 2 - Remove a service principal by application id

PS C:\> Remove-AzADServicePrincipal -ApplicationId 9263469e-d328-4321-8646-3e3e75d20e76

Removes the service principal with application id '9263469e-d328-4321-8646-3e3e75d20e76'.

Example 3 - Remove a service principal by SPN

PS C:\> Remove-AzADServicePrincipal -ServicePrincipalName MyServicePrincipal

Remove the service principal with service principal name "MyServicePrincipal"

Example 4 - Remove a service principal by piping

PS C:\> Get-AzADServicePrincipal -ObjectId 61b5d8ea-fdc6-40a2-8d5b-ad447c678d45 | Remove-AzADServicePrincipal

Gets the service principal with object id '61b5d8ea-fdc6-40a2-8d5b-ad447c678d45' and pipes that to the Remove-AzADServicePrincipal cmdlet to remove that service principal.

Example 5 - Remove a service principal by piping an application

PS C:\> Get-AzApplication -ApplicationId 9263469e-d328-4321-8646-3e3e75d20e76 | Remove-AzADServicePrincipal

Gets the application with application id '9263469e-d328-4321-8646-3e3e75d20e76' and pipes that to the Remove-AzADServicePrincipal cmdlet to remove the service principal associated with that application.

Parameters

-ApplicationId

The service principal application id.

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ApplicationObject

The application object whose service principal is being removed.

Type:Microsoft.Azure.Commands.ActiveDirectory.PSADApplication
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisplayName

The display name of the service principal.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Force

Switch to delete service principal without a confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

The service principal object.

Type:Microsoft.Azure.Commands.ActiveDirectory.PSADServicePrincipal
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ObjectId

The object id of the service principal to delete.

Type:String
Aliases:PrincipalId, Id
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PassThru

If specified, returns the deleted service principal.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServicePrincipalName

The service principal name.

Type:String
Aliases:SPN
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Guid

Microsoft.Azure.Commands.ActiveDirectory.PSADServicePrincipal

Microsoft.Azure.Commands.ActiveDirectory.PSADApplication

Outputs

Microsoft.Azure.Commands.ActiveDirectory.PSADServicePrincipal

Notes

Keywords: azure, azurerm, arm, resource, management, manager, resource, group, template, deployment