Get-ServicePrincipal

This cmdlet is available only in the cloud-based service.

Use the Get-ServicePrincipal cmdlet to view information about service principals in your cloud-based organization.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

Syntax

Get-ServicePrincipal
   [[-Identity] <ServicePrincipalIdParameter>]
   [-Organization <OrganizationIdParameter>]
   [<CommonParameters>]

Description

Service principals exist in Microsoft Entra ID to define what apps can do, who can access the apps, and what resources the apps can access. In Exchange Online, service principals are references to the service principals in Microsoft Entra ID. To assign Exchange Online role-based access control (RBAC) roles to service principals in Microsoft Entra ID, you use the service principal references in Exchange Online. The *-ServicePrincipal cmdlets in Exchange Online PowerShell let you view, create, and remove these service principal references.

For more information, see Application and service principal objects in Microsoft Entra ID.

You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the permissions required to run any cmdlet or parameter in your organization, see Find the permissions required to run any Exchange cmdlet.

Examples

Example 1

Get-ServicePrincipal

This example returns a summary list of all service principals within an organization.

Example 2

Get-ServicePrincipal -Identity ca73fffa-cedb-4b84-860f-d7fb8aa8a6c1 | Format-List

This example returns detailed information about the service principal with the ObjectId value ca73fffa-cedb-4b84-860f-d7fb8aa8a6c1.

Parameters

-Identity

The Identity parameter specifies the service principal that you want to view. You can use any value that uniquely identifies the service principal. For example:

  • Name
  • Distinguished name (DN)
  • GUID
  • AppId
  • ObjectId
Type:ServicePrincipalIdParameter
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Online, Security & Compliance, Exchange Online Protection

-Organization

This parameter is reserved for internal Microsoft use.

Type:OrganizationIdParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online, Security & Compliance, Exchange Online Protection