Add multiple members to multiple groups (MgGraph)

I have created an array of users and created an array of the groups to which a user should be member.
Have done this in the past in OnPrem Ad, but the same method does not seem to work with MGGraph.

# $Users = a list of users comma seperated example 'John ONe', 'Jane two','jacob three', etc 
$Members = $users | % {Get-MgUser -Filter "DisplayName eq '$($_)'"}
$Groups = Get-MgGroup -Filter "StartsWith(DisplayName,'AZU-WHA_')"
foreach ($User in $Members){
     foreach ($Group in $Groups)
         {
         New-MGGroupMemberByRef -Groupid $Group.id -DirectoryObjectId $User.id
         }
 }
New-MgGroupMemberByRef:
Line |
   4 |  New-MGGroupMemberByRef -Groupid $Group.id -DirectoryObjectId $User.id …
     |                                            ~~~~~~~~~~~~~~~~~~
     | A parameter cannot be found that matches parameter name 'DirectoryObjectId'.
New-MgGroupMemberByRef:

I have confirmed the $members array to verify that the Id value is correct.
Have used different ways to specify the $User.Id value, but none of them are accepted

$user.Id
'$User.Id'
'$($User.Id)'
$($User.Id)

Never mind, the same code works with new-MgGroupMember and not with NewMgGroupMemberByRef…