Ran into an issue recently that was a little tricky.  I have a DirSync environment and two of my users for some reason decided that their UPN was going to be username@domain.onmicrosoft.com rather than username@domain.com.  There was no issues on the AD side.  All the attributes for the account were set appropriately, but the UPN in particular was just not making it up to O365 appropriately anymore.  I used the following bit of PowerShell to resolve the issue.