Remove-AzADSpCredential

Removes key credentials or password credentials for an service principal.

Syntax

Remove-AzADSpCredential
      -ObjectId <String>
      [-KeyId <Guid>]
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADSpCredential
      [-KeyId <Guid>]
      -ServicePrincipalName <String>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADSpCredential
      [-KeyId <Guid>]
      -DisplayName <String>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADSpCredential
      [-KeyId <Guid>]
      -ServicePrincipalObject <IMicrosoftGraphServicePrincipal>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Removes key credentials or password credentials for an service principal.

Examples

Example 1: Remove service principal credentials by key id

Remove-AzADSpCredential -DisplayName $name -KeyId $keyid

Remove service principal credentials by key id

Example 2: Remove all credentials from service principal

Get-AzADServicePrincipal -DisplayName $name | Remove-AzADSpCredential

Remove all credentials from service principal

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:PSObject
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

The display name of service principal.

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

-KeyId

The key Id of credentials to be removed.

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

-ObjectId

The object Id of service principal.

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

-PassThru

Returns true when the command succeeds

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

-ServicePrincipalName

The service principal name.

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

-ServicePrincipalObject

The service principal object, could be used as pipeline input.

Type:IMicrosoftGraphServicePrincipal
Position:Named
Default value:None
Required:True
Accept pipeline input:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IMicrosoftGraphServicePrincipal

Outputs

Boolean

Notes

ALIASES

Remove-AzADServicePrincipalCredential