This information is in other articles that are posted but they can be overly complicated. This is the TLDR version.

Start Powershell

  • -start POWERSHELL (as administrator).

Office365 Endpoints | O365 Endpoints | Azure Endpoints | Microsoft Online Endpoints

From here you have the option to connect to different ENDPOINTS of Office365/AzureAD. The information is the same but data is displayed differently depending on which endpoint is being used.

The ENDPOINTS I use regularly are:

  1. OUTLOOK/Exchange-Online
  2. AzureAD
  3. MSOnline
  4. Graph (new!)
  5. Skype-for-Business/Teams
  6. Microsoft Teams

Note that all modules can be found here (although look closely as the names can be unnatural to some):
https://docs.microsoft.com/en-us/powershell/module/

See Installed Modules

If you want to see the installed modules in your current session, you can view by:

Get-InstalledModule

If you want to see all modules and their install location:

get-module -listavailable

Install Module

To connect to the endpoints, a module must be installed into Powershell. So if this is the first time, depending on the endpoint,use the following

  1. Outlook/Exchange-Online: type: Install-Module ExchangeOnlineManagement
  2. AzureAD: type: Install-Module AzureAD (or Install-Module AzureADPreview)
  3. MSOline: type: Install-Module MSOnline
  4. Graph: type: install-module microsoft.graph
  5. Skype-for-Business/Teams: Import-Module SkypeOnlineConnector
  6. Teams: Install-Module MicrosoftTeams

Note that this only has to be done once. After the module is installed into Powershell, it remains.

To install a few at the same time:
install-Module msonline,ExchangeOnlineManagement,AzureADPreview,Microsoft.Graph

Also note that since the AzureAd module is being actively developed, the "preview" module, or beta-version, has additional commands that the current release does not. However only one of the AzureAD modules (either AzureAD or AzureADPreview) can be installed at a time.

Connect to Endpoint

After the module is installed into Powershell, the connection is as follows:

  1. OUTLOOK/Exchange-Online: type:
    Connect-ExchangeOnline
    Connect-ExchangeOnline -UserPrincipalName This email address is being protected from spambots. You need JavaScript enabled to view it. -DelegatedOrganization adatum.onmicrosoft.com
    Old-way: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    Import-PSSession $Session -AllowClobber
  2. AzureAD: Connect-azuread
    Import-PSSession $Session -AllowClobber
  3. MSOnline: Connect-MsolService
  4. Graph: Connect-mggraph (It will ask for your creds via browser)
  5. Skype-for-Business/Teams: type:
    $sfbSession = New-CsOnlineSession
    Import-PSSession $sfbSession
  6. Teams: Connect-microsoftteams
    Import-PSSession $Session -AllowClobber

Which Endpoint Is Best

It depends on what you are trying to do.

  1. OUTLOOK/Exchange-Online: for the Exchange portion of Office365. Should be easy to determine if it is needed.
  2. AzureAD: new endpoint that seems to have development in the works. To me the commands are long and arduous but it has the advantage of automation or workflow.
  3. MSOnline: tried and true as a legacy option that seems to work best.
  4. MS Graph: the new, new endpoint that is the official current supported endpoint.
  5. Skype-for-Business/Teams: for the Skype-for-Business/Teams portion of Office365.
  6. Teams: for the Microsoft Teams portion of Office365.

Remove Module

Here is how to unload/remove a module:

remove-Module ModuleNameHere
(ie: remove-Module AzureAD)

Uninstall Module

Here is how to uninstall a module:

Uninstall-Module ModuleNameHere
(ie: Uninstall-Module AzureAD)

Or if you have multiple versions:
Uninstall-Module AzureADPreview -AllVersions