importing

Must use Windows PowerShell (not PowerShell 7)

Import-Module AzureAd -UseWindowsPowerShell

connecting

Connect-AzureAD

get a list of groups of which user is a member

Get-AzureADUser -SearchString hanawayc@gejohnson.com | Get-AzureADUserMembership | % {Get-AzureADObjectByObjectId -ObjectId $_.ObjectId | select DisplayName,ObjectType,MailEnabled,SecurityEnabled,ObjectId} | Format-Table

get a list of groups of which user is an owner

Get-AzureADUser -SearchString user@example.com | Get-AzureADUserOwnedObject

AzureAD POSH module is deprecated in favor of MS Graph.