https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-office-365-powershell
Step 1: Install required software
These steps are required once on your computer, not every time you connect. However, you'll likely need to install newer versions of the software periodically.
-
Install the 64-bit version of the Microsoft Online Services Sign-in Assistant: Microsoft Online Services Sign-in Assistant for IT Professionals RTW.
-
Install the Microsoft Azure Active Directory Module for Windows PowerShell with these steps:
- Open an administrator-level PowerShell command prompt.
- Run the Install-Module MSOnline command.
- If prompted to install the NuGet provider, type Y and press ENTER.
- If prompted to install the module from PSGallery, type Y and press ENTER.
- After installation, close the PowerShell command window