Set-EntraGroupLifecyclePolicy

Updates a specific group Lifecycle Policy in Microsoft Entra ID.

Syntax

Set-EntraGroupLifecyclePolicy
   -GroupLifecyclePolicyId <String>
   [-AlternateNotificationEmails <String>]
   [-GroupLifetimeInDays <Int32>]
   [-ManagedGroupTypes <String>]
   [<CommonParameters>]

Description

The Set-EntraGroupLifecyclePolicy command updates a specific group Lifecycle Policy in Microsoft Entra ID.

Examples

Example 1: Updates group lifecycle policy

Connect-Entra -Scopes 'Directory.ReadWrite.All'
$policy = Get-EntraGroupLifecyclePolicy | Where-Object {$_.AlternateNotificationEmails -eq 'example@contoso.com'}
Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId $policy.Id -GroupLifetimeInDays 200 -AlternateNotificationEmails 'example@contoso.com' -ManagedGroupTypes 'All'

Id                                   AlternateNotificationEmails GroupLifetimeInDays ManagedGroupTypes
--                                   --------------------------- ------------------- -----------------
ffffffff-5555-6666-7777-aaaaaaaaaaaa example@contoso.com                     200                 All

This example updates the specified groupLifecyclePolicy in Microsoft Entra ID.

  • -GroupLifecyclePolicyId parameter specifies the ID of the Lifecycle Policy to be modified.
  • -GroupLifetimeInDays parameter specifies the lifetime of the groups in the policy to 200 days. The GroupLifetimeInDays represents the number of days before a group expires and needs to be renewed. Once renewed, the group expiration is extended by the number of days defined.
  • -AlternateNotificationEmails parameter specifies the email address that receives notifications about the policy. Multiple email address can be defined by separating email address with a semicolon.
  • -ManagedGroupTypes parameter specifies which office 365 groups the policy applies to. Possible values are All, Selected, or None.
    In this case, 'All' suggests that the policy manages all types of groups.

Parameters

-AlternateNotificationEmails

Notification emails for groups that have no owners are sent to these email addresses. List of email addresses separated by a ";".

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

-GroupLifecyclePolicyId

Specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID.

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

-GroupLifetimeInDays

The number of days a group can exist before it needs to be renewed.

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

-ManagedGroupTypes

Allows the admin to select which office 365 groups the policy applies to.

  • "None" will create the policy in a disabled state.
  • "All" will apply the policy to every Office 365 group in the tenant.
  • "Selected" will allow the admin to choose specific Office 365 groups that the policy applies to.
Type:System.String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.String

Outputs

System.Object