fix: fetch all groups via -AllPages for large tenants
Replaces default 100-item page limits and =999 workarounds with -AllPages on group queries across assignment and baseline scripts. Enables full fzf inline search/filter for group selection.
This commit is contained in:
@@ -378,8 +378,8 @@ $groupCache = @{}
|
||||
if($baseline.ContainsKey("groups") -and $baseline["groups"])
|
||||
{
|
||||
Write-Host "`nResolving groups..." -ForegroundColor Cyan
|
||||
$existingGroupsResp = Invoke-GraphRequest "/groups?`$select=id,displayName&`$orderby=displayName&`$top=999"
|
||||
$existingGroups = $existingGroupsResp.value
|
||||
$existingGroupsResp = Invoke-GraphRequest "/groups?`$select=id,displayName&`$orderby=displayName" -AllPages
|
||||
$existingGroups = $existingGroupsResp
|
||||
|
||||
foreach($grpDef in $baseline["groups"])
|
||||
{
|
||||
@@ -413,8 +413,8 @@ if($baseline.ContainsKey("groups") -and $baseline["groups"])
|
||||
|
||||
#region Pre-load all existing groups for assignment resolution
|
||||
Write-Host "`nPre-loading group directory..." -ForegroundColor Cyan
|
||||
$allGroupsResp = Invoke-GraphRequest "/groups?`$select=id,displayName&`$orderby=displayName&`$top=999"
|
||||
foreach($g in $allGroupsResp.value)
|
||||
$allGroupsResp = Invoke-GraphRequest "/groups?`$select=id,displayName&`$orderby=displayName" -AllPages
|
||||
foreach($g in $allGroupsResp)
|
||||
{
|
||||
if(-not $groupCache.ContainsKey($g.displayName))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user