Edit

Get-AzADServicePrincipal

Filters active directory service principals.

Syntax

EmptyParameterSet (Default)

Get-AzADServicePrincipal
    [-DefaultProfile <IAzureContextContainer>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

SearchStringParameterSet

Get-AzADServicePrincipal
    -DisplayNameBeginsWith <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

DisplayNameParameterSet

Get-AzADServicePrincipal
    -DisplayName <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

ObjectIdParameterSet

Get-AzADServicePrincipal
    -ObjectId <Guid>
    [-DefaultProfile <IAzureContextContainer>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

ApplicationIdParameterSet

Get-AzADServicePrincipal
    -ApplicationId <Guid>
    [-DefaultProfile <IAzureContextContainer>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

ApplicationObjectParameterSet

Get-AzADServicePrincipal
    -ApplicationObject <PSADApplication>
    [-DefaultProfile <IAzureContextContainer>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

SPNParameterSet

Get-AzADServicePrincipal
    -ServicePrincipalName <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

Description

Filters active directory service principals.

Examples

Example 1 - List AD service principals

PS C:\> Get-AzADServicePrincipal

Lists all AD service principals in a tenant.

Example 2 - List AD service principals using paging

PS C:\> Get-AzADServicePrincipal -First 100

Lists the first 100 AD service principals in a tenant.

Example 3 - List service principals by SPN

PS C:\> Get-AzADServicePrincipal -ServicePrincipalName 36f81fc3-b00f-48cd-8218-3879f51ff39f

Lists service principals with the SPN '36f81fc3-b00f-48cd-8218-3879f51ff39f'.

Example 4 - List service principals by search string

PS C:\> Get-AzADServicePrincipal -SearchString "Web"

Lists all AD service principals whose display name start with "Web".

Example 5 - List service principals by piping

PS C:\> Get-AzADApplication -ObjectId aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb | Get-AzADServicePrincipal

Gets the AD application with object id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' and pipes it to the Get-AzADServicePrincipal cmdlet to list all service principals for that application.

Parameters

-ApplicationId

The service principal application id.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ApplicationIdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ApplicationObject

The application object whose service principal is being retrieved.

Parameter properties

Type:PSADApplication
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ApplicationObjectParameterSet
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisplayName

The service principal display name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DisplayNameParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DisplayNameBeginsWith

The service principal search string.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:SearchString

Parameter sets

SearchStringParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-First

The maximum number of objects to return.

Parameter properties

Type:UInt64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeTotalCount

Reports the number of objects in the data set. Currently, this parameter does nothing.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ObjectId

Object id of the service principal.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ObjectIdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ServicePrincipalName

SPN of the service.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:SPN

Parameter sets

SPNParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Skip

Ignores the first N objects and then gets the remaining objects.

Parameter properties

Type:UInt64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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.

Inputs

String

Guid

PSADApplication

Parameters: ApplicationObject (ByValue)

Outputs

PSADServicePrincipal