Get-AzureADMSServicePrincipal

Gets a service principal.

Syntax

Get-AzureADMSServicePrincipal
   [-All <Boolean>]
   [-Top <Int32>]
   [-Filter <String>]
   [-Select <String>]
   [<CommonParameters>]
Get-AzureADMSServicePrincipal
   [-SearchString <String>]
   [-All <Boolean>]
   [<CommonParameters>]
Get-AzureADMSServicePrincipal
   -Id <String>
   [-All <Boolean>]
   [-Select <String>]
   [<CommonParameters>]

Description

The Get-AzureADMSServicePrincipal cmdlet gets a service principal in Azure Active Directory (Azure AD).

Examples

Example 1

PS C:\> Get-AzureADMSServicePrincipal

Id                                 : 055aa618-7c74-40ee-b278-75545562c3d6
ObjectId                           :
DeletionTimestamp                  :
AccountEnabled                     : true
AppId                              : 6ff5f225-c1d3-46cc-b89e-39e679ff746f
AppDisplayName                     : App Name
ApplicationTemplateId              :
AppRoleAssignmentRequired          : False
CustomSecurityAttributes           :
DisplayName                        : App Name
ErrorUrl                           :
LogoutUrl                          :
Homepage                           :
IsManagementRestricted             :
SamlMetadataUrl                    :
MicrosoftFirstParty                :
PublisherName                      : Microsoft Services
PreferredTokenSigningKeyThumbprint :
ReplyUrls                          : {}
ServicePrincipalNames              : {6ff5f225-c1d3-46cc-b89e-39e679ff746f}
Tags                               : {}
KeyCredentials                     : {}
PasswordCredentials                : {}

Get all service principals from the directory.

Example 2

PS C:\> $sp = Get-AzureADMSServicePrincipal -Id 4a7c15df-ac88-44f3-84c6-fd0812701f29

Get a service principal by ID.

Example 3

PS C:\> $ServicePrincipalId = (Get-AzureADMSServicePrincipal -Top 1).Id
PS C:\> Get-AzureADMSServicePrincipal $ServicePrincipalId

The first command gets the ID of a service principal by using the Get-AzureADMSServicePrincipal cmdlet. The command stores the ID in the $ServicePrincipalId variable.

The second command gets the service principal identified by $ServicePrincipalId.

Example 4

PS C:\> Get-AzureADMSServicePrincipal -Select CustomSecurityAttributes
Get-AzureADMSServicePrincipal -Id 7d194b0c-bf17-40ff-9f7f-4b671de8dc20  -Select "CustomSecurityAttributes, Id"

List custom security attribute assignments for an application (service principal).

Parameters

-All

If true, return all serviceprincipal objects. If false, return the number of objects specified by the Top parameter

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Filter

Specifies an oData v3.0 filter statement. This parameter controls which objects are returned.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Id

Specifies the ID of a service principal in Azure AD.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SearchString

Specifies a search string.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Select

Specifies the properties to be returned on the object.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Top

Specifies the maximum number of records to return.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Nullable<T>[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Nullable<T>[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Outputs

Object