Unlike the on-premise set-up, it pretty easy to start the session, but with Office 365, you need to connect to each services and you also need to use the right module.
Connect to Exchange Online (use windows Exchange PS or Azure AD PS)
- Set-ExecutionPolicy RemoteSigned /Use global admin credential/
- $cred = get-credential
- $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
- Import-PSSession $Session
Connecting to AzureAD Preview (Use Azure Active Directory Shell)
- Uninstall-Module AzureADPreview
- Install-ConnectAzureADPreview
- Connect-AzureADconnect
Connect to SharePoint Online (Use SharePoint Online Management Shell)
- $orgName=”domain.com”
- Connect-SPOService -Url https://domain-admin.sharepoint.com
Connect to Microsoft o365 (You may use the regular PowerShell. This is for managing users, groups, etc)
- Connect-MsolService
- $cred = Get-Credential
- $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
- Import-PSSession $Session
Reference: Connect PowerShell to Office 365 services
Leave a Reply