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:
- OUTLOOK/Exchange-Online
- AzureAD
- MSOnline
- Graph (new!)
- Skype-for-Business/Teams
- 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
- Outlook/Exchange-Online: type: Install-Module ExchangeOnlineManagement
- AzureAD: type: Install-Module AzureAD (or Install-Module AzureADPreview)
- MSOline: type: Install-Module MSOnline
- Graph: type: install-module microsoft.graph
- Skype-for-Business/Teams: Import-Module SkypeOnlineConnector
- 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:
- OUTLOOK/Exchange-Online: type:
Connect-ExchangeOnline
Connect-ExchangeOnline -UserPrincipalNameThis 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 - AzureAD: Connect-azuread
Import-PSSession $Session -AllowClobber - MSOnline: Connect-MsolService
- Graph: Connect-mggraph (It will ask for your creds via browser)
- Skype-for-Business/Teams: type:
$sfbSession = New-CsOnlineSession
Import-PSSession $sfbSession - Teams: Connect-microsoftteams
Import-PSSession $Session -AllowClobber
Which Endpoint Is Best
It depends on what you are trying to do.
- OUTLOOK/Exchange-Online: for the Exchange portion of Office365. Should be easy to determine if it is needed.
- 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.
- MSOnline: tried and true as a legacy option that seems to work best.
- MS Graph: the new, new endpoint that is the official current supported endpoint.
- Skype-for-Business/Teams: for the Skype-for-Business/Teams portion of Office365.
- 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