Get-AzureRmADSpCredential

Retrieves a list of credentials associated with a service principal.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Get-AzureRmADSpCredential
   -ObjectId <Guid>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzureRmADSpCredential
   -ServicePrincipalName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzureRmADSpCredential
   -DisplayName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzureRmADSpCredential
   -ServicePrincipalObject <PSADServicePrincipal>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzureRmADSpCredential cmdlet can be used to retrieve a list of credentials associated with a service principal. This command will retrieve all of the credential properties (but not the credential value) associated with the service principal.

Examples

Example 1 - List credentials by SPN

PS C:\> Get-AzureRmADSpCredential -ServicePrincipalName http://test12345

Returns a list of credentials associated with the service principal with SPN 'http://test12345'.

Example 2 - List credentials by object id

PS C:\> Get-AzureRmADSpCredential -ObjectId 58e28616-99cc-4da4-b705-7672130e1047

Returns a list of credentials associated with the service principal with object id "58e28616-99cc-4da4-b705-7672130e1047".

Example 3 - List credentials by piping

PS C:\> Get-AzureRmADServicePrincipal -ObjectId 58e28616-99cc-4da4-b705-7672130e1047 | Get-AzureRmADSpCredential

Gets the service principal with object id "58e28616-99cc-4da4-b705-7672130e1047" and pipes it to the Get-AzureRmADSpCredential cmdlet to list all credentials for that service principal.

Parameters

-DefaultProfile

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

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

-DisplayName

The display name of the service principal

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

-ObjectId

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

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

-ServicePrincipalName

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

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

-ServicePrincipalObject

The service principal object to retrieve the credentials from.

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

Inputs

Guid

String

PSADServicePrincipal

Parameters: ServicePrincipalObject (ByValue)

Outputs

PSADCredential