fix: restore .value access when using -AllPages on group queries
Invoke-GraphRequest with -AllPages returns the full response object with accumulated items in .value, not a flat array.
This commit is contained in:
@@ -379,7 +379,7 @@ if($baseline.ContainsKey("groups") -and $baseline["groups"])
|
||||
{
|
||||
Write-Host "`nResolving groups..." -ForegroundColor Cyan
|
||||
$existingGroupsResp = Invoke-GraphRequest "/groups?`$select=id,displayName&`$orderby=displayName" -AllPages
|
||||
$existingGroups = $existingGroupsResp
|
||||
$existingGroups = $existingGroupsResp.value
|
||||
|
||||
foreach($grpDef in $baseline["groups"])
|
||||
{
|
||||
@@ -414,7 +414,7 @@ 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" -AllPages
|
||||
foreach($g in $allGroupsResp)
|
||||
foreach($g in $allGroupsResp.value)
|
||||
{
|
||||
if(-not $groupCache.ContainsKey($g.displayName))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user