Get-EntraServicePrincipalCreatedObject

Get objects created by a service principal.

Syntax

Get-EntraServicePrincipalCreatedObject
   -ServicePrincipalId <String>
   [-All]
   [-Top <Int32>]
   [-Property <String[]>]
   [<CommonParameters>]

Description

The Get-EntraServicePrincipalCreatedObject cmdlet gets an object created by a service principal in Microsoft Entra ID.

Examples

Example 1: Retrieve the objects that created by a service principal

Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Get-EntraServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId

This example gets objects created by the service principal identified by $ServicePrincipalId. You can use the command Get-EntraServicePrincipal to get service principal ID.

  • -ServicePrincipalId parameter specifies the service principal ID.

Example 2: Retrieve the all objects created by a service principal

Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Get-EntraServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId -All

This example demonstrates how to get the all object created by a specified service principal in Microsoft Entra ID.

  • -ServicePrincipalId parameter specifies the service principal ID.

Example 3: Retrieve the top two objects created by a service principal

Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Get-EntraServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId -Top 2

This example demonstrates how to get the top two object created by a specified service principal in Microsoft Entra ID.

  • -ServicePrincipalId parameter specifies the service principal ID.

Parameters

-All

List all pages.

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Property

Specifies properties to be returned.

Type:System.String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ServicePrincipalId

Specifies the ID of a service principal in Microsoft Entra ID.

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

-Top

Specifies the maximum number of records to return.

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