Get-AzureADServicePrincipal

Get-AzureADServicePrincipal

Gets an Active Directory service principal.

Syntax

Parameter Set: EmptyParameterSet
Get-AzureADServicePrincipal [-Profile <AzureProfile> ] [-ServicePrincipalName <String> ] [ <CommonParameters>]

Parameter Set: ObjectIdParameterSet
Get-AzureADServicePrincipal -ObjectId <Guid> [-Profile <AzureProfile> ] [ <CommonParameters>]

Parameter Set: SearchStringParameterSet
Get-AzureADServicePrincipal -SearchString <String> [-Profile <AzureProfile> ] [ <CommonParameters>]

Parameter Set: SPNParameterSet
Get-AzureADServicePrincipal -ServicePrincipalName <String> [-Profile <AzureProfile> ] [ <CommonParameters>]

Detailed Description

The Get-AzureADServicePrincipal cmdlet gets an Azure Active Directory service principal.

Parameters

-ObjectId<Guid>

Specifies the object ID of the service principal to get.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Profile<AzureProfile>

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SearchString<String>

Specifies the display name of the service principal to get.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ServicePrincipalName<String>

Specifies the name of the service principal to get.

Aliases

SPN

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Get a service principal by object ID

This command gets the Active Directory service principal that has the object ID of 36f81fc3-b00f-48cd-8218-3879f51ff39f.

Get-AzureADServicePrincipal -ObjectId 36f81fc3-b00f-48cd-8218-3879f51ff39f

Example 2: Get service principals by search string

This command gets all Active Directory service principals that include Web in the display name.

Get-AzureADServicePrincipal -SearchString "Web"

Example 3: Get all service principals

This command gets all Active Directory service principals.

Get-AzureADServicePrincipal

Get-AzureADGroup

Get-AzureADUser

Get-AzureADGroupMember

Remove-AzureADServicePrincipal