The script should look like this (not tested!)
Import-Module ActiveDirectory
Get-ADGroupMember -Identity "GroupA" |
ForEach-Object {Add-AzADGroupMember -Identity "GroupB" -Members $_
Remove-ADGroupMember "GroupA" $_ -Confirm:$false
}
https://learn.microsoft.com/en-us/powershell/module/addsadministration/get-adgroupmember?view=win10-ps
https://learn.microsoft.com/en-us/powershell/module/addsadministration/add-adgroupmember?view=win10-ps
https://learn.microsoft.com/en-us/powershell/module/addsadministration/remove-adgroupmember?view=win10-ps
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten