Get-AzADServicePrincipal

Filters active directory service principals.

Syntax

Get-AzADServicePrincipal
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADServicePrincipal
   -DisplayNameBeginsWith <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADServicePrincipal
   -DisplayName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADServicePrincipal
   -ObjectId <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADServicePrincipal
   -ApplicationId <Guid>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADServicePrincipal
   -ApplicationObject <PSADApplication>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
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 39e64ec6-569b-4030-8e1c-c3c519a05d69 | Get-AzADServicePrincipal

Gets the AD application with object id '39e64ec6-569b-4030-8e1c-c3c519a05d69' and pipes it to the Get-AzADServicePrincipal cmdlet to list all service principals for that application.

Parameters

-ApplicationId

The service principal application id.

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ApplicationObject

The application object whose service principal is being retrieved.

Type:Microsoft.Azure.Commands.ActiveDirectory.PSADApplication
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisplayName

The service principal display name.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DisplayNameBeginsWith

The service principal search string.

Type:String
Aliases:SearchString
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-First

The maximum number of objects to return.

Type:UInt64
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IncludeTotalCount

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

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ObjectId

Object id of the service principal.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServicePrincipalName

SPN of the service.

Type:String
Aliases:SPN
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Skip

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

Type:UInt64
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Guid

Microsoft.Azure.Commands.ActiveDirectory.PSADApplication

Outputs

Microsoft.Azure.Commands.ActiveDirectory.PSADServicePrincipal