Forum Discussion
EdSchreibman
Jun 24, 2021Copper Contributor
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-AzureADDirectoryRoleMember , I think I'm missing how to add "" somewhere in "-ObjectId $admins.ObjectId"?
code:
$admins = Get-AzureADDirectoryRole | where{$_.displayname -like "*administrator"}
Get-AzureADDirectoryRoleMember -ObjectId $admins.ObjectId
- 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.
- 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.- EdSchreibmanCopper ContributorPerfect. Thanks
- MAzimNSRCopper Contributor
VasilMichevIt sloved my issue, thanks for posting solution