Skip to content

Commit

Permalink
AADRoleEligibilityScheduleRequest - Fix Custom Role assignment at app…
Browse files Browse the repository at this point in the history
… scope.
  • Loading branch information
NikCharlebois committed Nov 13, 2024
1 parent a6530b9 commit 102604e
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,20 @@
return $nullResult
}
$RoleDefinitionId = (Get-MgBetaRoleManagementDirectoryRoleDefinition -Filter "DisplayName eq '$RoleDefinition'").Id
$schedule = Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule -Filter "PrincipalId eq '$($request.PrincipalId)' and RoleDefinitionId eq '$RoleDefinitionId'"
$schedules = Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule -Filter "PrincipalId eq '$($request.PrincipalId)'"
$schedule = $schedules | Where-Object -FilterScript {$_.RoleDefinitionId -eq $RoleDefinitionId}
if ($null -eq $schedule)
{
foreach ($instance in $schedules)
{
$roleDefinitionInfo = Get-MgBetaRoleManagementDirectoryRoleDefinition -UnifiedRoleDefinitionId $instance.RoleDefinitionId
if ($null -ne $roleDefinitionInfo -and $RoleDefinitionInfo.DisplayName -eq $RoleDefinition)
{
$schedule = $instance
break
}
}
}
}
if ($null -eq $schedule -or $null -eq $request)
{
Expand Down

0 comments on commit 102604e

Please sign in to comment.