The error comes while executing the Get-MsolUser Azure AD PowerShell command to fetch Office 365 users.
Follow the below steps to fix the issue.
Step-1:
Download and install the Microsoft Online Services Sign-In Assistant for IT Professionals RTW from this MSDN URL. The Microsoft Online Services Sign-In Assistant provides end-user sign-in capabilities to Microsoft Online Services, such as Office 365.
Once the installation is over, you can verify in the control panel.
Step-2:
Then Open Windows PowerShell in administrator mode and run the following command.
Install-Module MSOnline -Force
Step-3:
Now you can run the below command,
Connect-MsolService
Once you run the above command, it will ask you to enter the credentials, make sure to enter the global Office 365 admin account.