You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running Add-MgGroupToLifecyclePolicy throws Add-MgGroupToLifecyclePolicy : Object reference not set to an instance of an object. but still adds group to the lifecycle policy. Seems to have issues parsing the response correctly.
Here's the debug log, as you can see, the request has completed successfuly, but cmdlet threw an exception
PS C:\Users\some_user> Add-MgGroupToLifecyclePolicy -GroupLifecyclePolicyId ca1ad70c-1368-42d3-a5e8-d6cbb67a4bfc -GroupId 1a28df02-8e99-4cd6-94df-eed334be76a5 -Debug
DEBUG: [CmdletBeginProcessing]: - Add-MgGroupToLifecyclePolicy begin processing with parameterSet 'AddExpanded'.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): A
DEBUG: [Authentication]: - AuthType: 'Delegated', AuthProviderType: 'InteractiveAuthenticationProvider', ContextScope:
'CurrentUser', AppName: 'Microsoft Graph PowerShell'.
DEBUG: [Authentication]: - Scopes: [Group.ReadWrite.All, openid, profile, Team.Create, TeamMember.ReadWrite.All,
TeamSettings.ReadWrite.All, User.ReadBasic.All, email, Directory.ReadWrite.All].
Confirm
Are you sure you want to perform this action?
Performing the operation "Add-MgGroupToLifecyclePolicy_AddExpanded" on target "Call remote
'GroupLifecyclePoliciesAddGroup' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): A
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.com/v1.0/groupLifecyclePolicies/ca1ad70c-1368-42d3-a5e8-d6cbb67a4bfc/microsoft.graph.addGroup
Headers:
Body:
{
"groupId": "1a28df02-8e99-4cd6-94df-eed334be76a5"
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : d5ead9d8-a5dd-4720-a7eb-9a8c5f5864df
client-request-id : d5ead9d8-a5dd-4720-a7eb-9a8c5f5864df
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Central
US","Slice":"E","Ring":"3","ScaleUnit":"004","RoleInstance":"CH01EPF00003EB5"}}
OData-Version : 4.0
Cache-Control : no-cache
Date : Fri, 03 Jun 2022 16:31:40 GMT
Location : https://graph.microsoft.com/
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean",
"value": true
}
DEBUG: [CmdletException]: Received exception with message 'NullReferenceException - Object reference not set to an
instance of an object. : at
Microsoft.Graph.PowerShell.Cmdlets.AddMgGroupToLifecyclePolicy_AddExpanded.<onOk>d__64.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Groups.<GroupLifecyclePoliciesAddGroup_Call>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Graph.PowerShell.Groups.<GroupLifecyclePoliciesAddGroup_Call>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Groups.<GroupLifecyclePoliciesAddGroup>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Cmdlets.AddMgGroupToLifecyclePolicy_AddExpanded.<ProcessRecordAsync>d__61.MoveNext()'
Confirm
Object reference not set to an instance of an object.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): A
Add-MgGroupToLifecyclePolicy : Object reference not set to an instance of an object.
At line:1 char:1
+ Add-MgGroupToLifecyclePolicy -GroupLifecyclePolicyId ca1ad70c-1368-42 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-MgGroupToLifecyclePolicy_AddExpanded], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.AddMgGroupToLifecyclePolicy_AddExpanded
DEBUG: [CmdletEndProcessing]: - Add-MgGroupToLifecyclePolicy end processing.
The text was updated successfully, but these errors were encountered:
Running
Add-MgGroupToLifecyclePolicy
throwsAdd-MgGroupToLifecyclePolicy : Object reference not set to an instance of an object.
but still adds group to the lifecycle policy. Seems to have issues parsing the response correctly.Here's the debug log, as you can see, the request has completed successfuly, but cmdlet threw an exception
The text was updated successfully, but these errors were encountered: