Hello,
In this case, you need use the following approach:
$groupGuids = $Context.TargetObject.GetEx("adm-DirectMemberOfGuid")
It will get you the GUIDs of all the groups the target user is a member of including Microsoft Entra ones. Pay attention that the latter part will only work in case you ahve your Microsoft Entra domain registered in Adaxes (the domain will be visible under the Managed domains node in the Administratoin console).