Skip to content

Revoke-MgUserSign NullReferenceException #1241

@commakoerschgen

Description

@commakoerschgen

The cmdlet Revoke-MgUserSign internally suffers a NullReferenceException. The actual revocation is performed successfully and the exception occurs during response parsing.

Sample session:

PS C:\> Revoke-MgUserSign -UserId 0b2de3b6-ee9b-4c88-a846-bf26b146d42a
Revoke-MgUserSign_Revoke1: Object reference not set to an instance of an object.

PS C:\> Revoke-MgUserSign -UserId 0b2de3b6-ee9b-4c88-a846-bf26b146d42a -Debug
DEBUG: [CmdletBeginProcessing]: - Revoke-MgUserSign begin processing with parameterSet 'Revoke1'.
DEBUG: [Authentication]: - AuthType: 'Delegated', AuthProviderType: 'InteractiveAuthenticationProvider', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph PowerShell'.
DEBUG: [Authentication]: - Scopes: [AuditLog.Read.All, Directory.Read.All, Domain.Read.All, openid, Policy.Read.All, profile, User.Read, email, User.ReadWrite.All].

Confirm
Are you sure you want to perform this action?
Performing the operation "Revoke-MgUserSign_Revoke1" on target "Call remote 'UsersRevokeSignInSessions1' operation".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): yes
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/users/0b2de3b6-ee9b-4c88-a846-bf26b146d42a/microsoft.graph.revokeSignInSessions

Headers:
SdkVersion                    : graph-powershell/1.9.5,Graph-dotnet-1.25.1
FeatureFlag                   : 00000047
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19044; en-US),PowerShell/7.2.2,Revoke-MgUserSign_Revoke1
Accept-Encoding               : gzip

Body:



DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Transfer-Encoding             : chunked
Location                      : https://graph.microsoft.com/
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : c83d8f73-7201-4ba6-867f-b2015462d662
client-request-id             : c83d8f73-7201-4ba6-867f-b2015462d662
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"004","RoleInstance":"AM2PEPF0000BE5B"}}
x-ms-resource-unit            : 1
OData-Version                 : 4.0
Date                          : Tue, 03 May 2022 11:35:43 GMT

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.RevokeMgUserSign_Revoke1.onOk(HttpResponseMessage responseMessage, Task`1 response)
   at Microsoft.Graph.PowerShell.UsersActions.UsersRevokeSignInSessions1_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.PowerShell.UsersActions.UsersRevokeSignInSessions1_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.PowerShell.UsersActions.UsersRevokeSignInSessions1(String userId, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.PowerShell.Cmdlets.RevokeMgUserSign_Revoke1.ProcessRecordAsync()'
Revoke-MgUserSign_Revoke1: Object reference not set to an instance of an object.
DEBUG: [CmdletEndProcessing]: - Revoke-MgUserSign end processing.

This happens for both v1.0 and beta. SDK version 1.9.5, Powershell version 7.2.2

On a side note, the last part of the endpoint is microsoft.graph.revokeSignInSessions while the documentation says that it should just be revokeSignInSessions. That does not seem to be the problem, however.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions