Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Get-AzADServicePrincipal
- Module:
- Az.Resources Module
Lists entities from service principals or get entity from service principals by key
Syntax
EmptyParameterSet (Default)
Get-AzADServicePrincipal
[-Select <String[]>]
[-Count]
[-Filter <String>]
[-Orderby <String[]>]
[-Search <String>]
[-ConsistencyLevel <String>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[-CountVariable <String>]
[<CommonParameters>]
ObjectIdParameterSet
Get-AzADServicePrincipal
-ObjectId <String>
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
SearchStringParameterSet
Get-AzADServicePrincipal
-DisplayNameBeginsWith <String>
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
DisplayNameParameterSet
Get-AzADServicePrincipal
-DisplayName <String>
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
ApplicationIdParameterSet
Get-AzADServicePrincipal
-ApplicationId <Guid>
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
ApplicationObjectParameterSet
Get-AzADServicePrincipal
-ApplicationObject <IMicrosoftGraphApplication>
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
SPNParameterSet
Get-AzADServicePrincipal
-ServicePrincipalName <String>
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Description
Lists entities from service principals or get entity from service principals by key
Examples
Example 1: Get service principal by display name
Get-AzADServicePrincipal -DisplayName $name
Get service principal by display name
Example 2: Search for service principal display name starts with
Get-AzADServicePrincipal -DisplayNameStartsWith $prefix
Search for service principal display name starts with
Example 3: List service principals
Get-AzADServicePrincipal -First 10 -Select Tags -AppendSelected
List first 10 service principals and append property 'Tags' after default properties: 'DisplayName', 'Id', 'DeletedDateTime', 'ServicePrincipalNames', 'AppId'
Example 4: Get service principal by application Id
Get-AzADServicePrincipal -ApplicationId $appId
Get service principal by application Id
Example 5: Get service principal by pipeline input
Get-AzADApplication -DisplayName $name | Get-AzADServicePrincipal
Get service principal by pipeline input
Example 6: Get service principal with filter
Get-AzADServicePrincipal -Filter "startsWith(DisplayName,'some-name')"
Get service principal with filter
Example 7: Assign OdataCount to a variable
Get-AzADServicePrincipal -First 10 -ConsistencyLevel eventual -Count -CountVariable 'result'
$result
Assign OdataCount to a variable
Parameters
-AppendSelected
Append properties selected with default properties when this switch is on, only works with parameter '-Select'.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ApplicationId
application id of serviceprincipal
Parameter properties
| Type: | Guid |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AppId |
Parameter sets
-ApplicationObject
The service principal object, could be used as pipeline input.
Parameter properties
| Type: | IMicrosoftGraphApplication |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ConsistencyLevel
Indicates the requested consistency level. Documentation URL: https://developer.microsoft.com/en-us/office/blogs/microsoft-graph-advanced-queries-for-directory-objects-are-now-generally-available/
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Count
Include count of items
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-CountVariable
Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | PSObject |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-DisplayName
serviceprincipal display name
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DisplayNameBeginsWith
serviceprincipal display name starts with
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | DisplayNameStartsWith, SearchString |
Parameter sets
-Filter
Filter items by property values, for more detail about filter query please see: https://learn.microsoft.com/en-us/graph/filter-query-parameter
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-First
Gets only the first 'n' objects.
Parameter properties
| Type: | UInt64 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ObjectId
key: id of servicePrincipal
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ServicePrincipalId, Id |
Parameter sets
-Orderby
Order items by property values
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Search
Search items by search phrases
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Select
Select properties to be returned
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ServicePrincipalName
serviceprincipal name
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | SPN |
Parameter sets
-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
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
IMicrosoftGraphApplication
Outputs
IMicrosoftGraphServicePrincipal
Azure PowerShell
Feedback
Was this page helpful?
