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?
2
Answers
The Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule/Get-AzRoleEligibilitySchedule-: The command retrieves the eligibility schedule for a resource scope in
Azure Active Directory
Using this cmdlet, administrators can gather information about when certain roles can be assigned to users, helping them plan and manage role assignments efficiently within their
Azure AD environment
.The Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleInstance/Get-AzRoleEligibilityScheduleInstance : The command retrieves the specified role eligibility schedule instance in
Azure Active Directory
It’s important to note that the Beta in
Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule
andGet-MgBetaRoleManagementDirectoryRoleEligibilityScheduleInstance
indicates that these are in theMicrosoft Graph Beta API
, which means they are not yet generally available and could be subject to changes. On the Azure side,Get-AzRoleEligibilitySchedule
andGet-AzRoleEligibilityScheduleInstance
are part of the stableAz module
forAzure PowerShell.
Reference :
Get-AzRoleEligibilitySchedule & Get-AzRoleEligibilityScheduleInstance
Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule
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