The following script will return a list of the distribution groups a Office 365 / Exchange on-line user is a member of.

Connecting to Office 365

Getting a users distribution group membership

Change user@domain.com to the correct email address for the user.