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:
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:
If you run next command you will get all currently available commands:
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:
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 🙂