Life cycle policies in Microsoft Entra ID automate group and user account management based on defined rules. Admins add groups to life cycle policies to automate management, enhance security, ensure compliance, and optimize resources. Graph PowerShell's Add-MgGroupToLifecyclePolicy command, an alternative to the Add-AzureADMSLifecyclePolicyGroup PowerShell command, can be used to add groups to life cycle policies.
Before running the Get-MgGroupLifecyclePolicy cmdlet, ensure the following requirements are met:
Install-Module Microsoft.Graph -Scope CurrentUser
The Add-MgGroupToLifecyclePolicy cmdlet can be used in Microsoft Graph PowerShell to add groups to life cycle policies. Here's the syntax:
Add-MgGroupToLifecyclePolicy
-GroupLifecyclePolicyId <String>
[-ResponseHeadersVariable <String>]
[-AdditionalProperties <Hashtable>]
[-GroupId <String>]
[-Headers <IDictionary>]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Adding a group to a life cycle policy
Import-Module Microsoft.Graph.Groups
$params = @{
groupId = "8ae1075f-b5e7-4548-8312-fcf9998a3fbd"
}
Add-MgGroupToLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId -BodyParameter $params
The following table contains some parameters that can be used along with the MgGroupToLifecyclePolicy command to add groups to life cycle policies.
| Parameters | Description |
|---|---|
| -GroupId | This parameter displays the unique identifier of the group. |
| -GroupLifecyclePolicyId | This parameter displays the unique identifier of the group life cycle policy. |
| -Headers | This parameter allows you to add optional headers to the request. |
| -ResponseHeadersVariable | This parameter allows you to add option response header variables. |
| -WhatIf | This parameter displays the outcome if the cmdlet is executed. |
ManageEngine ADManager Plus is an identity governance and administration solution, with comprehensive Microsoft Entra ID management and reporting capabilities, that eliminates the hassle of complex PowerShell scripts. Its intuitive, user-friendly interface allows you to streamline even the most complex administrative tasks in minutes.