Get-AzureRmADSpCredential

Retrieves a list of credentials associated with a service principal.

Important

Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024.

To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.

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:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases: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
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
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
Accept pipeline input:True
Accept wildcard characters:False
-ServicePrincipalObject

The service principal object to retrieve the credentials from.

Type:Microsoft.Azure.Graph.RBAC.Version1_6.ActiveDirectory.PSADServicePrincipal
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

Inputs

Guid

String

Microsoft.Azure.Graph.RBAC.Version1_6.ActiveDirectory.PSADServicePrincipal

Parameters: ServicePrincipalObject (ByValue)

Outputs

Microsoft.Azure.Graph.RBAC.Version1_6.ActiveDirectory.PSADCredential