http://blogs.technet.com/b/heyscriptingguy/archive/2014/03/24/getting-started-with-office-365-and-powershell.aspx