Edit

Share via


Get-EntraBetaDeletedServicePrincipal

Retrieves the list of previously deleted service principals.

Syntax

GetQuery (Default)

Get-EntraBetaDeletedServicePrincipal

    [-Filter <String>]
    [-All]
    [-Top <Int32>]
    [-Property <String[]>]
    [<CommonParameters>]

GetVague

Get-EntraBetaDeletedServicePrincipal

    [-SearchString <String>]
    [-All]
    [-Property <String[]>]
    [<CommonParameters>]

GetById

Get-EntraBetaDeletedServicePrincipal

    -ServicePrincipalId <String>
    [-All]
    [-Property <String[]>]
    [<CommonParameters>]

Description

The Get-EntraBetaDeletedServicePrincipal cmdlet Retrieves the list of previously deleted service principals.

Examples

Example 1: Get list of deleted service principals

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraBetaDeletedServicePrincipal | Select-Object Id, DisplayName, AppId, DeletedDateTime, DeletionAgeInDays, ServicePrincipalType | Format-Table -AutoSize
Id                                   DisplayName            AppId                                DeletedDateTime       DeletionAgeInDays ServicePrincipalType
--                                   -----------            -----                                ---------------       ----------------- --------------------
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso Marketing      00001111-aaaa-2222-bbbb-3333cccc4444 2/10/2025 11:07:07 AM                 10 Application
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb ProjectWorkManagement  22223333-cccc-4444-dddd-5555eeee6666 2/12/2025 11:07:56 AM                 8  ManagedIdentity
dddddddd-3333-4444-5555-eeeeeeeeeeee Enterprise App1        33334444-dddd-5555-eeee-6666ffff7777 2/11/2025 11:07:56 AM                 11 ManagedIdentity

This cmdlet retrieves the list of deleted service principals.

Example 2: Get list of deleted service principals using All parameter

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraBetaDeletedServicePrincipal -All | Select-Object Id, DisplayName, AppId, DeletedDateTime, DeletionAgeInDays, ServicePrincipalType | Format-Table -AutoSize
Id                                   DisplayName            AppId                                DeletedDateTime       DeletionAgeInDays ServicePrincipalType
--                                   -----------            -----                                ---------------       ----------------- --------------------
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso Marketing      00001111-aaaa-2222-bbbb-3333cccc4444 2/10/2025 11:07:07 AM                 10 Application
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb ProjectWorkManagement  22223333-cccc-4444-dddd-5555eeee6666 2/12/2025 11:07:56 AM                 8  ManagedIdentity
dddddddd-3333-4444-5555-eeeeeeeeeeee Enterprise App1        33334444-dddd-5555-eeee-6666ffff7777 2/11/2025 11:07:56 AM                 11 ManagedIdentity

This cmdlet retrieves the list of deleted service principals using All parameter.

Example 3: Get top two deleted service principals

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraBetaDeletedServicePrincipal -Top 2 | Select-Object Id, DisplayName, AppId, DeletedDateTime, DeletionAgeInDays, ServicePrincipalType | Format-Table -AutoSize
Id                                   DisplayName            AppId                                DeletedDateTime       DeletionAgeInDays ServicePrincipalType
--                                   -----------            -----                                ---------------       ----------------- --------------------
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso Marketing      00001111-aaaa-2222-bbbb-3333cccc4444 2/10/2025 11:07:07 AM                 10 Application
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb ProjectWorkManagement  22223333-cccc-4444-dddd-5555eeee6666 2/12/2025 11:07:56 AM                 8  ManagedIdentity

This cmdlet retrieves top two deleted service principals. You can use -Limit as an alias for -Top.

Example 4: Get deleted service principals using SearchString parameter

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraBetaDeletedServicePrincipal -SearchString 'Contoso Marketing' | Select-Object Id, DisplayName, AppId, DeletedDateTime, DeletionAgeInDays, ServicePrincipalType | Format-Table -AutoSize
Id                                   DisplayName            AppId                                DeletedDateTime       DeletionAgeInDays ServicePrincipalType
--                                   -----------            -----                                ---------------       ----------------- --------------------
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso Marketing      00001111-aaaa-2222-bbbb-3333cccc4444 2/10/2025 11:07:07 AM                 10 Application

This cmdlet retrieves deleted service principals using SearchString parameter.

Example 5: Get deleted service principals filter by display name

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraBetaDeletedServicePrincipal -Filter "DisplayName eq 'Contoso Marketing'" | Select-Object Id, DisplayName, AppId, DeletedDateTime, DeletionAgeInDays, ServicePrincipalType | Format-Table -AutoSize
Id                                   DisplayName            AppId                                DeletedDateTime       DeletionAgeInDays ServicePrincipalType
--                                   -----------            -----                                ---------------       ----------------- --------------------
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso Marketing      00001111-aaaa-2222-bbbb-3333cccc4444 2/10/2025 11:07:07 AM                 10 Application

This cmdlet retrieves deleted service principals having specified display name.

Example 6: Get deleted service principal by ServicePrincipalId

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraBetaDeletedServicePrincipal -ServicePrincipalId 'bbbbbbbb-1111-2222-3333-cccccccccccc' | Select-Object Id, DisplayName, AppId, DeletedDateTime, DeletionAgeInDays, ServicePrincipalType | Format-Table -AutoSize
Id                                   DisplayName            AppId                                DeletedDateTime       DeletionAgeInDays ServicePrincipalType
--                                   -----------            -----                                ---------------       ----------------- --------------------
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso Marketing      00001111-aaaa-2222-bbbb-3333cccc4444 2/10/2025 11:07:07 AM                 10 Application

This cmdlet retrieves the deleted service principal specified by ServicePrincipalId.

  • -ServicePrincipalId parameter specifies the deleted service principal Id.

Parameters

-All

List all pages.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Filter

Retrieve only those deleted service principals that satisfy the filter.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

GetQuery
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Property

Specifies properties to be returned

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Select

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SearchString

Retrieve only those service principals that satisfy the -SearchString value.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

GetVague
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ServicePrincipalId

The unique ID of the deleted service principal to be retrieved.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Id

Parameter sets

GetById
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Top

The maximum number of service principals.

Parameter properties

Type:System.Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Limit

Parameter sets

GetQuery
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

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

System.String

System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Outputs

System.Object