AzureADAssessment icon indicating copy to clipboard operation
AzureADAssessment copied to clipboard

Index was outside the bounds of the array when calling Invoke-AADAssessmentDataCollection

Open ztrhgf opened this issue 3 years ago • 1 comments

Error bellow when calling Invoke-AADAssessmentDataCollection

image

When I debug 2.2.2\internal\Expand-MsGraphRelationship.ps1 it turns out that:

  • $inputObject contained one item image when final block started. But $results variable was empty, because there was no user in "Exchange administrator" role! Therefore error on line [array] $refValues = $Results[$i]
  • btw $uri contained directoryRoles/{0}/members/$ref

SOLUTION? In 2.2.2\internal\Expand-MsGraphRelationship.ps1 modify both foreach from: for ($i = 0; $i -lt $InputObjects.Count; $i++) { to: for ($i = 0; $i -lt $Results.Count; $i++) {

ztrhgf avatar Dec 28 '21 12:12 ztrhgf

HI @ztrhgf, can you check with our latest preview version?

PS> Install-Module -Name AzureADAssessment -AllowPrerelease

Cédric

cblomart avatar Jul 19 '22 16:07 cblomart

The code that led to this error has been completely replaced with roleDefinitions api so this should be resolved now. Let us know if you still see any errors.

jazuntee avatar Sep 02 '22 15:09 jazuntee