Get-EntraServicePrincipalOwnedObject
Gets an object owned by a service principal.
Syntax
Get-EntraServicePrincipalOwnedObject
[-All]
-ServicePrincipalId <String>
[-Top <Int32>]
[-Property <String[]>]
[<CommonParameters>]
Description
The Get-EntraServicePrincipalOwnedObject
cmdlet retrieves an object owned by a service principal in Microsoft Entra ID.
Examples
Example 1: Retrieve the owned objects of a service principal
Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId
Id DeletedDateTime
-- ---------------
bbbbbbbb-1111-2222-3333-cccccccccccc
The command retrieves the owned objects of a service principal.
-ServicePrincipalId
Parameter specifies the ID of a service principal.
Example 2: Retrieve the all owned objects of a service principal
Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipalId = (Get-EntraServicePrincipal -Filter "DisplayName eq '<user-display-name>'").ObjectId
Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipalId -All
Id DeletedDateTime
-- ---------------
bbbbbbbb-1111-2222-3333-cccccccccccc
cccccccc-2222-3333-4444-dddddddddddd
This example retrieves an object owned by a service principal in Microsoft Entra ID. You can use the command Get-EntraServicePrincipal
to get service principal Id.
-ServicePrincipalId
parameter specifies the ID of a service principal.
Example 2: Retrieve all owned objects of a service principal
Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId -All
Id DeletedDateTime
-- ---------------
bbbbbbbb-1111-2222-3333-cccccccccccc
cccccccc-2222-3333-4444-dddddddddddd
The command receives the all owned objects of a service principal.
-ServicePrincipalId
Parameter specifies the ID of a service principal.
Example 3: Retrieve top one owned object of a service principal
Connect-Entra -Scopes 'Application.Read.All'
$ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq '<service-principal-display-name>'"
Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId -Top 1
Id DeletedDateTime
-- ---------------
bbbbbbbb-1111-2222-3333-cccccccccccc
This example retrieves the top one owned object of a specified service principal in Microsoft Entra ID.
-ServicePrincipalId
parameter specifies the ID of a service principal.
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 |