Create roleAssignmentScheduleRequests fail with RoleNotFound error.
If we create role definition using HTTP API (same also if using MS Graph Python SDK; client credential OAUTH auth):
https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions
{
"description": "Role description",
"displayName": "RoleDefinitionTest",
"rolePermissions":
[
{
"allowedResourceActions":
[
"microsoft.directory/applications/basic/read"
]
}
],
"isEnabled": true
}
Note: Role permission can be anything, the action up is just as an example.
And try to assign a new eligible (or active) role schedule request:
https://graph.microsoft.com/v1.0/roleManagement/directory/roleEligibilityScheduleRequests
{
"action": "adminAssign",
"justification": "Assign test...",
"roleDefinitionId": <ROLEDEFINITIONTEST_UUID>,
"directoryScopeId": "/",
"principalId": <SOME_USER__UUID>,
"scheduleInfo": {
"startDateTime": "2022-04-10T00:00:00Z",
"expiration": {
"type": "afterDateTime",
"endDateTime": "2024-10-10T00:00:00Z"
}
}
}
The request fails with error like:
{
"error": {
"code": "RoleNotFound",
"message": "The role is not found.",
"innerError": {
"date": "2024-06-30T12:44:58",
"request-id": "f81f6d94-77ea-4865-bb34-8201341f5a72",
"client-request-id": "f81f6d94-77ea-4865-bb34-8201341f5a72"
}
}
}
If running same using Powershell MS Graph SDK, it passes. Also if accesing the created role definition throught Entra Admin console and trying just to add some assigments, and then run roleEligibilityScheduleRequests again after some time, the same request passes ok.
Is this expected to work? Is there some other role action needed to be executed prior running roleEligibilityScheduleRequests?