Remove-EntraServicePrincipalKeyCredential
Removes a key credential from a service principal.
Syntax
Remove-EntraServicePrincipalKeyCredential
-ServicePrincipalId <String>
-KeyId <String>
[<CommonParameters>]
Description
The Remove-EntraServicePrincipalKeyCredential cmdlet removes a key credential from a service principal in Microsoft Entra ID.
Examples
Example 1: Remove a key credential
Connect-Entra -Scopes 'Application.ReadWrite.All', 'Application.ReadWrite.OwnedBy'
$servicePrincipal = Get-EntraServicePrincipal -Filter "displayName eq 'Helpdesk Application'"
$key = Get-EntraServicePrincipalKeyCredential -ServicePrincipalId $servicePrincipal.Id
Remove-EntraServicePrincipalKeyCredential -ServicePrincipalId $servicePrincipal.Id -KeyId $key.Id
This example demonstrates how to remove a key credential from a service principal in Microsoft Entra ID.
Parameters
-KeyId
Specifies the ID of a key credential.
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 |