A script I recently used to add members to an office 365 distribution group using a remote exchange session in a hybrid setup (covered at the end). 

[cc lang="powershell"]$SourceFile = ""
Import-CSV $SourceFile | ForEach `
{Add-DistributionGroupMember -Identity "Group Name" -Member $_.UPN
Write-Host -ForegroundColor Green "Processed the record for $($_.UPN)"
}[/cc]

CSV file contains UPNs of all users to be added.

I also found it useful to see who had permissions to send to this group using

[cc lang="powershell"](Get-DistributionGroup -Identity "Group Name").AcceptMessagesOnlyFrom | ForEach {Get-User -Identity $_}[/cc]

To open remote exchange shell:

[cc lang="powershell"]$UserCredential = Get-Credential[/cc]

A prompt will appear for your login credentials then,

[cc lang="powershell"]$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session[/cc]

Afterwards, remember to remove the session

[cc lang="powershell"]Remove-PSSession $Session[/cc]