Viewing and managing Microsoft Entra ID group life cycle policies is essential for automating group expiration, renewal, and cleanup, ensuring efficient governance and compliance. IT administrators often need to retrieve these group life cycle policies to monitor enforcement and make necessary adjustments. While the Get-MgGroupLifecyclePolicy PowerShell command in Microsoft Graph allows admins to fetch life cycle policy details, it requires a lot of scripting and manual effort.
Before running the Get-MgGroupLifecyclePolicy cmdlet, ensure the following requirements are met:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Group.Read.All"
Use the Get-MgGroupLifecyclePolicy cmdlet in Microsoft Graph PowerShell to retrieve Microsoft Entra ID groups' life cycle policies. The syntax is as follows:
Get-MgGroupLifecyclePolicy
[-ExpandProperty <String[]>]
[-Property <String[]>]
[-Filter <String>]
[-Search <String>]
[-Skip <Int32>]
[-Sort <String[]>]
[-Top <Int32>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PageSize <Int32>]
[-All]
[-CountVariable <String>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Example: How to get the life cycle policy of a Microsoft Entra ID group
Import-Module Microsoft.Graph.Groups
Get-MgGroupLifecyclePolicy
The table below lists key parameters that can be used with the Get-MgGroupLifecyclePolicy cmdlet to efficiently retrieve Microsoft Entra ID groups.
| Parameters | Description |
|---|---|
| -All | This lists all pages. |
| -GroupLifecyclePolicyID | This is the unique identifier of a group's life cycle policy. |
| -CountVariable | This specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope. |
| -Filter | This filters the items by property values. |
| -GroupID | This is the unique identifier of a group. |