During troublesome Office 365 migrations you may want to get the ImmtableIDs and UPNs of all the users using 365 to troubleshoot single sign on issues. The Azure powershell below exports both pieces of information to a CSV.
Connect-MsolService $onlineusers = Get-MsolUser -All | Select-Object UserprincipalName,ImmutableID,WhenCreated,LastDirSyncTime $onlienusers | Export-Csv c:\temp\OnlineUser.csv -NoTypeInformation
I used this powershell recently when a client had issues soft linking 365 with ADFS.