I'm trying to update AzureADGroupMember for multiple users in a CSV File by UPN.
This is what I've came across and attempted:
$users = Import-csv "C:\Temp\testgroup2.csv"
$users | ForEach-Object{
Add-AzureGroupADGroupMember -ObjectId xcv9890-stest999-xcvxc234-xcv2342324
-RefObjectId (Get-AzureADUser -ObjectId $_.UPN).ObjectId
}
I get the following 2 errors.
Import-csv : The member "Role" is already present.
At line:1 char:10
Get-AzureADUser : Cannot bind argument to parameter 'ObjectId' because it
is null.
At line:4 char:120
Any idea why this keeps happening? I would really appreciate the help.
Thank you,