Office 365: Manage licenses and subscriptions for Office 365
This code sample loads the Office 365 cmdlets using import-module MSOnline and, after importing the cmdlets module, Windows PowerShell is connected to the Microsoft Online Services using Connect-MsolService, which asks for Office 365 user credentials.