This one is more a reminder for my self, but may come in handy for you too ­čÖé

When you want to manage O365 subscription with Powershell you first need to login to it:

Connect-MsolService

This command will open a new window for you to sign in to your subscription:

After logging, you may execute the next command just to confirm that it was successful:

Get-MsolSubscription

If you run next command you will get all currently available commands:

get-command *msol*

As you will see from the list, for example, Exchange OnLine commands are not available. For you to access those, you need to authenticate to that service particularly.

$UserCredential = Get-Credential #Put your credential in variable to use later

$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $ExchangeSession -DisableNameChecking

You will get something similar to this:

Now you will be available to use commands like “Get-Mailbox” and others.

When you finish with your work, don’t forget to close your session:

Remove-PSSession $ExchangeSession

Connecting to Skype for Business Online:

Import-Module SkypeOnlineConnector

$sfboSession = New-CsOnlineSession -Credential $UserCredential

Import-PSSession $sfboSession

Connecting to SharePoint Online:

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

#Now you have imported the PowerShell module, next step is to determine the SharePoint Online admin site URL so that you can connect to it.

#https://-admin.sharepoint.com

#If Fully Qualified Domain Name (FQDN) is tech-trainer.onmicrosoft.com, the hostname is tech-trainer.

#When you have determined the site URL, execute the following command to connect to SharePoint Online. 

Connect-SPOService -Url https://tech-trainer.sharepoint.com -credential $UserCredential

#To verify the connection, execute the following command.

Get-SPOSite

 

Have another great day in Admins life ­čÖé

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.