Get-EntraServicePrincipalPasswordCredential
Get credentials for a service principal.
Syntax
Get-EntraServicePrincipalPasswordCredential
-ServicePrincipalId <String>
[<CommonParameters>]
Description
The Get-EntraServicePrincipalPasswordCredential
cmdlet gets the password credentials for a service principal in Microsoft Entra ID.
Examples
Example 1: Retrieve the password credential of a service principal
Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Get-EntraServicePrincipalPasswordCredential -ServicePrincipalId $ServicePrincipal.ObjectId
CustomKeyIdentifier DisplayName EndDateTime Hint KeyId SecretText StartDateTime
------------------- ----------- ----------- ---- ----- ---------- -------------
17-04-2025 07:32:41 gjW bdf6a3df-cc9b-4612-b948-e32804ee88f7 17-04-2024 07:32:41
21-03-2025 08:12:08 4fl 7f4414ec-8f72-49a8-b949-70d635899656 21-03-2024 08:12:08
12-12-2024 08:39:07 mjl 0fff6b21-0a20-4f7c-93ba-26ed9b648344 12-12-2023 08:39:10
This example retrieves the password credentials for specified service principal in Microsoft Entra ID.
-ServicePrincipalId
parameter specifies the object ID of a service principal. You can use the commandGet-EntraServicePrincipal
to get a service principal Id.
Parameters
-ServicePrincipalId
Specifies the ID of the service principal for which to get password credentials.
Type: | System.String |
Aliases: | ObjectId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |