I am working with the Az and the Graph Powershell Module, getting information about role assignments in Entra ID and Azure Resource Manager. I found that there is two commands each I can use to query information about what user has which eligible role assignments.
For Entra ID:
Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule
Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleInstance
For Azure Resource Manager:
Get-AzRoleEligibilitySchedule
Get-AzRoleEligibilityScheduleInstance
So what is the difference between a schedule and a schedule instance? Which one represents the role assignment I see in the Azure Portal (UI)? Is one deprecated and preferred over the other?
The portal shows you role eligibility schedule instances.
If you create a role eligibility schedule with a start time in the future:
..and then check portal, it's empty.
If you query role eligibility schedules, you see the
Granted
schedule:..but if you query role eligibility schedule instances (again before the start time), the response is empty:
Checking portal again after the start time (plus a few mins for something to happen behind the scenes in PIM) you see the role eligibility schedule instance:
Same in the role eligibility schedule instances API:
I'm unaware of any way to see future-dated schedules in the portal.
Interestingly, if you go back to the role eligibility schedules after the start time passes, the
status
,startDateTime
,createdOn
andupdatedOn
fields have all been touched:Only words I've ever found to describe the difference are here: https://learn.microsoft.com/en-us/rest/api/authorization/privileged-role-eligibility-rest-sample#list-eligible-assignments
HTH