< Back

Remove-AzureRmADSpCredential

Tue Jan 29, 2019 10:05 pm

NAME Remove-AzureRmADSpCredential



SYNOPSIS

Removes a credential from a service principal.





SYNTAX

Remove-AzureRmADSpCredential -All [-DefaultProfile <IAzureContextContainer>] [-Force] -ObjectId <String> [-Confirm] [-WhatIf] [<CommonParameters>]



Remove-AzureRmADSpCredential -All [-DefaultProfile <IAzureContextContainer>] [-Force] -ServicePrincipalName <String> [-Confirm] [-WhatIf]

[<CommonParameters>]



Remove-AzureRmADSpCredential [-DefaultProfile <IAzureContextContainer>] [-Force] -KeyId <Guid> -ObjectId <String> [-Confirm] [-WhatIf]

[<CommonParameters>]



Remove-AzureRmADSpCredential [-DefaultProfile <IAzureContextContainer>] [-Force] -KeyId <Guid> -ServicePrincipalName <String> [-Confirm] [-WhatIf]

[<CommonParameters>]





DESCRIPTION

The Remove-AzureRmADSpCredential cmdlet can be used to remove a credential key from a service principal in the case of a compromise or as part of

credential key rollover expiration. The service principal is identified by supplying either the object ID or service principal name (SPN).



The credential to be removed is identified by its key ID if an individual credential is to be removed or with an 'All' switch to delete all

credentials associated with the service principal.





PARAMETERS

-All [<SwitchParameter>]

Switch to remove all the credentials associated with the service principal.



Required? true

Position? named

Default value False

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Switch to delete credential without a confirmation.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-KeyId <Guid>

Specifies the credential key to be removed. The key Ids for a service principal can be obtained using the Get-AzureRmADSpCredential cmdlet.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ObjectId <String>

The object id of the service principal to remove the credentials from.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServicePrincipalName <String>

The name (SPN) of the service principal to remove the credentials from.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]





Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS



NOTES









Example 1



PS E:\\> Remove-AzureRmADSpCredential -ObjectId 7663d3fb-6f86-4352-9e6d-cf9d50d5ee82 -KeyId 9044423a-60a3-45ac-9ab1-09534157ebb



This command removes a credential key from a service principal. In this example, the key with Id "9044423a-60a3-45ac-9ab1-09534157ebb" will be

removed from the service principal.





Example 2



PS E:\\> Remove-AzureRmADSpCredential -ServicePrincipalName http://test123 -All



This command removes a credential key from a service principal. In this example, all credentials will be removed from the service principal

associated with the service principal name "http://test123".







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... credential

Get-AzureRmADSpCredential

New-AzureRmADSpCredential

Get-AzureRmADServicePrincipal