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
Hello,
I am using version 2.27.0 of the Microsoft.Graph.Identity module to self activate an eligible Entra role in PIM.
The request fails with "Value cannot be null.\r\nParameter name: action".
This is the code I am using:
$params = ConvertTo-Json (
@{
"Action" = "selfActivate"
"principalId" = $PrincipalId
"roleDefinitionId" = $RoleDefinitionId
"directoryScopeId" = $DirectoryScopeId
"justification" = $justification
"scheduleInfo" = @{
#StartDateTime = Get-Date
"StartDateTime" = $StartDateTime
"Expiration" = @{
"Type" = "AfterDuration"
"Duration" = $Duration
}
}
}
)
Describe the bug
Hello,
I am using version 2.27.0 of the Microsoft.Graph.Identity module to self activate an eligible Entra role in PIM.
The request fails with "Value cannot be null.\r\nParameter name: action".
This is the code I am using:
$params = ConvertTo-Json (
@{
"Action" = "selfActivate"
"principalId" = $PrincipalId
"roleDefinitionId" = $RoleDefinitionId
"directoryScopeId" = $DirectoryScopeId
"justification" = $justification
"scheduleInfo" = @{
#StartDateTime = Get-Date
"StartDateTime" = $StartDateTime
"Expiration" = @{
"Type" = "AfterDuration"
"Duration" = $Duration
}
}
}
)
New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest -BodyParameter $params
With Microsoft.Graph.Identity version 2.26.1 the request works fine.
Could you pleas investigate the issue?
Thanks,
Vincent
Expected behavior
The command works like in Microsoft.Graph.Identity version 2.26.1
$params = ConvertTo-Json (
@{
"Action" = "selfActivate"
"principalId" = $PrincipalId
"roleDefinitionId" = $RoleDefinitionId
"directoryScopeId" = $DirectoryScopeId
"justification" = $justification
"scheduleInfo" = @{
#StartDateTime = Get-Date
"StartDateTime" = $StartDateTime
"Expiration" = @{
"Type" = "AfterDuration"
"Duration" = $Duration
}
}
}
)
New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest -BodyParameter $params
How to reproduce
Replace
$StartDateTime = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ")
$params = ConvertTo-Json (
@{
"Action" = "selfActivate"
"principalId" = $PrincipalId
"roleDefinitionId" = $RoleDefinitionId
"directoryScopeId" = "/"
"justification" = $justification
"scheduleInfo" = @{
#StartDateTime = Get-Date
"StartDateTime" = $StartDateTime
"Expiration" = @{
"Type" = "AfterDuration"
"Duration" = $Duration
}
}
}
)
New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest -BodyParameter $params
SDK Version
2.27.0
Latest version known to work for scenario above?
2.26.1
Known Workarounds
No response
Debug output
DEBUG: [CmdletBeginProcessing]: - New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest begin processing with parameterSet 'Create'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [RoleEligibilitySchedule.ReadWrite.Directory].
Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest_Create" on target "Call remote 'POST /roleManagement/directory/roleAssignmentScheduleRequests' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignmentScheduleRequests
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; en-US),PowerShell/7.4.7
SdkVersion : graph-powershell/2.27.0
client-request-id : 52d730b4-f9a7-484e-9491-4eb65f05198e
Accept-Encoding : gzip,deflate,br
Body:
{}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Cache-Control : private
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 18b86625-57b9-408a-9ba3-87ae388f76c0
client-request-id : 52d730b4-f9a7-484e-9491-4eb65f05198e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"004","RoleInstance":"FR2PEPF00000B3B"}}
Date : Fri, 09 May 2025 08:28:12 GMT
Body:
{
"error": {
}
}
New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest_Create: Value cannot be null.
Parameter name: action
Status: 400 (BadRequest)
ErrorCode: ArgumentNullException
Date: 2025-05-09T08:28:13
Headers:
Cache-Control : private
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 18b86625-57b9-408a-9ba3-87ae388f76c0
client-request-id : 52d730b4-f9a7-484e-9491-4eb65f05198e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"004","RoleInstance":"FR2PEPF00000B3B"}}
Date : Fri, 09 May 2025 08:28:12 GMT
DEBUG: [CmdletEndProcessing]: - New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest end processing.
Configuration
Host Application: C:\Program Files\PowerShell\7\pwsh.dll
PSVersion: 7.4.7
PSEdition: Core
GitCommitId: 7.4.7
OS: Microsoft Windows 10.0.19045
Platform: Win32NT
Other information
No response
The text was updated successfully, but these errors were encountered: