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. Open an elevated Windows PowerShell Command Prompt window (run Windows PowerShell as an administrator).
  2. Run this command:
Install-Module -Name MSOnline

Step 2: Connect to MS Online Service for your Microsoft 365 subscription

To connect to MS Online Service for your Microsoft 365 subscription with an account name and password or with multi-factor authentication, run one of these commands from a Windows PowerShell command prompt. (It doesn’t have to be elevated.)

Connect-MSOnline
Get-MsolUser -All | select DisplayName -ExpandProperty StrongAuthenticationUserDetails | ft DisplayName, PhoneNumber, Email