Then run SharePoint Management Shell (if you have SharePoint in your machine) or SharePoint Online Management Shell.
In my case I already have a SharePoint Online site, if you don't, go to office.microsoft.com and give it a try.
After that go to the admin site and check the availability as it's the admin URL you need to connect to with the Connect-SPOService cmdlet.
With the credential parameter you need to pass a user with admin privileges to your Office 365 site. If it's one of your domain yours, make sure your domain is connected to the office 365 environment with ADFS.
It will ask for your password.
OK, the next thing is to find out the stuff you can do with PowerShell in O365. Simple, type cmdlet help SPO or Get-Command -Module Microsoft.Online.SharePoint.PowerShell in shell window.
Simply, you are through. Try out the listed cmdlets.