Get-EntraBetaDeletedGroup
This cmdlet is used to retrieve the soft deleted groups in a Microsoft Entra ID.
Syntax
Get-EntraBetaDeletedGroup
[-Filter <String>]
[-All]
[-Top <Int32>]
[-Property <String[]>]
[<CommonParameters>]
Get-EntraBetaDeletedGroup
-GroupId <String>
[-Property <String[]>]
[<CommonParameters>]
Get-EntraBetaDeletedGroup
[-All]
[-SearchString <String>]
[-Property <String[]>]
[<CommonParameters>]
Description
This cmdlet retrieves soft-deleted groups from a directory. When a group is deleted, it is soft deleted and can be recovered within 30 days. After 30 days, the group is permanently deleted and cannot be recovered.
Please note that soft delete currently applies only to Unified Groups (also known as Office 365 Groups).
Examples
Example 1: Get deleted groups in the directory
Connect-Entra -Scopes 'Group.Read.All'
Get-EntraBetaDeletedGroup | Select-Object Id, DisplayName, MailNickname, GroupTypes, DeletedDateTime, DeletionAgeInDays | Format-Table -AutoSize
Id DisplayName MailNickname GroupTypes DeletedDateTime DeletionAgeInDays
-- ----------- ------------ ---------- --------------- -----------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Contoso Group contosogroup {Unified} 2/12/2025 12:34:13 PM 10
This cmdlet retrieves all recoverable deleted groups in the Microsoft Entra ID.
Example 2: Get deleted groups in the directory using All parameter
Connect-Entra -Scopes 'Group.Read.All'
Get-EntraBetaDeletedGroup -All | Select-Object Id, DisplayName, MailNickname, GroupTypes, DeletedDateTime, DeletionAgeInDays | Format-Table -AutoSize
Id DisplayName MailNickname GroupTypes DeletedDateTime DeletionAgeInDays
-- ----------- ------------ ---------- --------------- -----------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Contoso Group contosogroup {Unified} 2/12/2025 12:34:13 PM 10
This cmdlet retrieves all recoverable deleted groups in the directory, using All parameter.
Example 3: Get top two deleted groups
Connect-Entra -Scopes 'Group.Read.All'
Get-EntraBetaDeletedGroup -Top 2 | Select-Object Id, DisplayName, MailNickname, GroupTypes, DeletedDateTime, DeletionAgeInDays | Format-Table -AutoSize
Id DisplayName MailNickname GroupTypes DeletedDateTime DeletionAgeInDays
-- ----------- ------------ ---------- --------------- -----------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Contoso Group contosogroup {Unified} 2/12/2025 12:34:13 PM 10
This cmdlet retrieves top two deleted groups in the directory. You can use -Limit
as an alias for -Top
.
Example 4: Get deleted groups containing string 'test2'
Connect-Entra -Scopes 'Group.Read.All'
Get-EntraBetaDeletedGroup -SearchString 'Contoso Group' | Select-Object Id, DisplayName, MailNickname, GroupTypes, DeletedDateTime, DeletionAgeInDays | Format-Table -AutoSize
Id DisplayName MailNickname GroupTypes DeletedDateTime DeletionAgeInDays
-- ----------- ------------ ---------- --------------- -----------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Contoso Group contosogroup {Unified} 2/12/2025 12:34:13 PM 10
This cmdlet retrieves deleted groups in the directory, containing the specified string.
Example 5: Get deleted groups filter by display name
Connect-Entra -Scopes 'Group.Read.All'
Get-EntraBetaDeletedGroup -Filter "displayName eq 'Contoso Group'" | Select-Object Id, DisplayName, MailNickname, GroupTypes, DeletedDateTime, DeletionAgeInDays | Format-Table -AutoSize
Id DisplayName MailNickname GroupTypes DeletedDateTime DeletionAgeInDays
-- ----------- ------------ ---------- --------------- -----------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Contoso Group contosogroup {Unified} 2/12/2025 12:34:13 PM 10
This cmdlet retrieves deleted groups in the directory, having the specified display name.
Example 6: Get deleted group by GroupId
Connect-Entra -Scopes 'Group.Read.All'
Get-EntraBetaDeletedGroup -GroupId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' | Select-Object Id, DisplayName, MailNickname, GroupTypes, DeletedDateTime, DeletionAgeInDays | Format-Table -AutoSize
Id DisplayName MailNickname GroupTypes DeletedDateTime DeletionAgeInDays
-- ----------- ------------ ---------- --------------- -----------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Contoso Group contosogroup {Unified} 2/12/2025 12:34:13 PM 10
This cmdlet retrieves the deleted group specified by GroupId.
-GroupId
parameter specifies the deleted group GroupId.
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 |
-Filter
Specifies an OData v4.0 filter statement. This parameter controls which objects are returned.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-GroupId
The GroupId of the deleted group to be retrieved.
Type: | System.String |
Aliases: | Id |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Property
Specifies properties to be returned
Type: | System.String[] |
Aliases: | Select |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SearchString
Specifies a search string.
Type: | System.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: | System.Int32 |
Aliases: | Limit |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
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