Get-EntraServicePrincipalKeyCredential
Get key credentials for a service principal.
Syntax
Default (Default)
Get-EntraServicePrincipalKeyCredential
-ServicePrincipalId <String>
[<CommonParameters>]
Description
The Get-EntraServicePrincipalKeyCredential
cmdlet gets the key credentials for a service principal in Microsoft Entra ID.
Examples
Example 1: Retrieve the key credential of a service principal
Connect-Entra -Scopes 'Application.Read.All'
$servicePrincipal = Get-EntraServicePrincipal -Filter "displayName eq 'Helpdesk Application'"
Get-EntraServicePrincipalKeyCredential -ServicePrincipalId $servicePrincipal.Id
CustomKeyIdentifier DisplayName EndDateTime Key KeyId StartDateTime Type Usage
------------------- ----------- ----------- --- ----- ------------- ---- -----
08-02-2025 09:57:08 68b45e27-fef8-4f0d-bc7a-76bd949c16d1 08-02-2024 09:57:08 Symmetric Sign
This example retrieves the key credentials for specified service principal in Microsoft Entra ID. You can use the command Get-EntraServicePrincipal
to get a service principal object Id.
-ServicePrincipalId
parameter specifies the service principal Id.
Parameters
-ServicePrincipalId
Specifies the ID of the application for which to get the password credential.
Parameter properties
Type: | System.String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | ObjectId |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.