The Get-MsolServicePrincipalCredential cmdlet in PowerShell gets credentials associated with a service principal in Microsoft Office 365.
The syntax to get the credential properties of a service principal is given below.
Get-MsolServicePrincipalCredential -ObjectId <Guid> -AppPrincipalId <Guid> -ReturnKeyValues <Boolean> -ServicePrincipalName <String> [-TenantId <Guid>] [<CommonParameters>]
In this article, we will discuss how to use the Get-MsolServicePrincipalCredential cmdlet in PowerShell to get the credential properties of a service principal in Azure Active Directory.
How to Get Credential Properties of a Service Principal
To get the credential properties of a service principal in Office 365, use the Get-MsolServicePrincipalCredential cmdlet with the
-ServicePrincipalName parameter specifies the name of the service principal from which to get credentials. The
-ReturnKeyValues parameter indicates whether this command returns key values.
Get-MsolServicePrincipalCredential -ServicePrincipalName "ShellGeek/ShellApp.com" -ReturnKeyValues $true
This command gets all the credentials properties that are associated with the service principal name “ShellGeek/ShellApp.com“.
Note: This command doesn’t return the credential value of the service principal.
I hope the above article on how to use the Get-MsolServicePrincipalCredential cmdlet in PowerShell to get the credentials of a service principal is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.