Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mfaData array #28

Open
brandilton opened this issue Feb 20, 2024 · 0 comments
Open

mfaData array #28

brandilton opened this issue Feb 20, 2024 · 0 comments

Comments

@brandilton
Copy link

brandilton commented Feb 20, 2024

this is what my mfaData array looked like for some users:

$mfaData = @(
    @{
        "Id" = "28c10230-6103-485e-b985-444c60001490"
        "AdditionalProperties" = @{
            "@odata.type" = "#microsoft.graph.passwordAuthenticationMethod"
            "createdDateTime" = "2022-08-22T20:15:01Z"
        }
    },
    @{
        "Date" = @("Tue, 20 Feb 2024 18:25:46 GMT")
        "OData-Version" = @("4.0")
        "x-ms-ags-diagnostic" = @("{}")
        "Vary" = @("Accept-Encoding")
        "Transfer-Encoding" = @("chunked")
        "client-request-id" = @("d1cb00e6-e362-45ef-8484-f7dfd8ec29de")
        "Strict-Transport-Security" = @("max-age=31536000")
        "request-id" = @("ef51d0d8-e5fb-4831-a44c-6d200cd927cb")
    }
)

on the second pass of the foreach loop it would error with Cannot index into a null array.

I fixed it by filtering down mfaData to just elements that contain AdditionalProperties:

$mfaDataFiltered = $mfaData | Where-Object { $_.AdditionalProperties  }
ForEach ($method in $mfaDataFiltered) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant