How to Connect to Microsoft 365 with PowerShell

This article has not been completed yet. However, it may already contain  helpful Information and therefore it has been published at this stage

Step 1: Install the required software

These steps are required only one time on your computer. But you'll likely need to update the software periodically.

  1. If you're not running Windows 10, install the 64-bit version of the Microsoft Online Services Sign-in Assistant: Microsoft Online Services Sign-in Assistant for IT Professionals RTW.
choco install msoidcli -y -f

Follow these steps to install the Microsoft Azure Active Directory Module for Windows PowerShell:

  1. Open an elevated Windows PowerShell command prompt (run Windows PowerShell as an administrator).
  2. Run the Install-Module MSOnline command.
Install-Module MSOnline
  1. If you're prompted to install the NuGet provider, type Y and press Enter.
  2. If you're prompted to install the module from PSGallery, type Y and press Enter.
Connect-MsolService
Get-MsolUser

Sources:

Connect to Microsoft 365 with PowerShell - Microsoft 365 Enterprise
Connect to your Microsoft 365 tenant by using PowerShell for Microsoft 365 to do admin center tasks from the command line.
Microsoft Online Services Sign-In Assistant 2.1
The Microsoft Online Services Sign-In Assistant provides end user sign-in capabilities to Microsoft Online Services, such as Office 365.