Hi Everyone this is Prem, I have worked as Microsoft 365 support ambassador. In this blog I will share how to Connect to Microsoft 365 Admin Center using PowerShell (MSOL).
Steps to Connect to Microsoft 365 Admin Center using PowerShell:
Search for windows PowerShell on your computer and run it as an administrator:

Once opened it should look like this:

Now we will run the following command in the PowerShell to install the Module which will help us to connect to Microsoft 365 admin center:

Install-Module -Name MsOnline -Scope CurrentUser
(If prompted to allow the installation please allow the same)
Now we will run the following:
Import-Module MsOnline

If you get error that running script is disabled then run the following command and after this run the above Import command again:
Set-ExecutionPolicy unrestricted
Allow it to set the execution policy if prompted.
Import-Module MsOnline
Once import is completed run the below command to connect:
Connect-MsolService

Enter your Global Admin email address and password (Depending on the task to be performed on the PowerShell you can use different admin account as well).
If you have Multifactor Authentication enabled on the account then you will have to complete the second steps of Authentication (Text, Call, Authenticator app, etc.) as well and after it is completed you should be connected to Office 365 Admin Center using PowerShell.
By following the above steps, you should be able to connect to Microsoft Office 365 using PowerShell.
Date:3/08/2022
Author: Prem
Tags: How to Connect to Microsoft 365 Admin Center using PowerShell