Forum Discussion

EdSchreibman's avatar
EdSchreibman
Copper Contributor
Jun 24, 2021
Solved

Azure Cloud Shell error with string

I get this error: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ObjectId'. Specified method is not | supported.'   Trying to pass this variable to Get-AzureAD...
  • VasilMichev's avatar
    Jun 24, 2021
    Well there are multiple built-in roles that match your query, so the $admins variable is effectively an array, meaning that $admins.ObjectId is not a string either. This will work:

    Get-AzureADDirectoryRoleMember -ObjectId $admins[0].ObjectId

    and repeat for each group.

Resources