Add User Phone Numbers and Require Microsoft 365 MFA with PowerShell
Question details
Create Microsoft 365 users in bulk, add their phone numbers as authentication methods, and require multifactor authentication.

- Product
- Microsoft 365 and Microsoft Entra ID
- Device & OS
- not provided
- Scenario
- An administrator wants to provision accounts and phone-based MFA settings in bulk using PowerShell.
- Observed behavior
- A basic user-creation command does not automatically add phone authentication methods or require MFA.
Prepare a CSV with DisplayName, UserPrincipalName, MailNickname, Password, and PhoneNumber columns; use a verified domain and include each phone number with its country code. Confirm that your administrator has the required Microsoft Graph permissions and Entra roles, phone authentication is allowed by policy, and Conditional Access licensing is available.
Create Users and Add Phone Methods with Microsoft Graph PowerShell
Use Microsoft Graph to provision accounts and phone authentication methods, then require MFA through an Entra Conditional Access policy.
New-MsolUser belongs to the retired MSOnline module. Microsoft Graph PowerShell is the current approach for these tasks.
A contact phone number is not the same as a phone authentication method. Adding an authentication method also does not, by itself, require a user to perform MFA.
In PowerShell, run Install-Module Microsoft.Graph -Scope CurrentUser, then run Connect-MgGraph -Scopes 'User.ReadWrite.All','UserAuthenticationMethod.ReadWrite.All'. Sign in with an administrator account that has the appropriate Entra roles and can grant the required consent.
Save the prepared file as users.csv and run the following script, replacing the path as needed: $users = Import-Csv 'C:\path\users.csv' foreach ($row in $users) { $profile = @{ Password = $row.Password; ForceChangePasswordNextSignIn = $true } $user = New-MgUser -AccountEnabled -DisplayName $row.DisplayName -UserPrincipalName $row.UserPrincipalName -MailNickname $row.MailNickname -PasswordProfile $profile New-MgUserAuthenticationPhoneMethod -UserId $user.Id -PhoneNumber $row.PhoneNumber -PhoneType mobile } Test with a small set of new users first and review errors before processing the full list.
In the Microsoft Entra admin center, open Protection > Conditional Access > Policies and select New policy. Select the intended users or group and cloud apps, then under Grant select Require multifactor authentication. Exclude emergency access accounts, test in report-only mode, and enable the policy after reviewing the results.
In the Entra admin center, open Users, select a test user, and check Authentication methods for the mobile number. Test sign-in to a targeted app and confirm the Conditional Access policy requires MFA; assign Microsoft 365 licenses separately if needed.

Organize User Provisioning Lists with WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for easy migration. Use WPS Spreadsheets to organize a provisioning list; Microsoft Entra and Graph are still required to create accounts and configure MFA.

Frequently Asked Questions
Does adding a mobile phone number automatically enable MFA?
No. A phone authentication method provides a way to authenticate, but an MFA requirement must be applied separately, such as through an Entra Conditional Access policy.
Can I still use New-MsolUser for new provisioning scripts?
New-MsolUser is part of the retired MSOnline module. Use Microsoft Graph PowerShell commands such as New-MgUser for new provisioning workflows.
Where can I check a user's authentication phone number?
In the Microsoft Entra admin center, open Users, select the user, and open Authentication methods. Check that the mobile phone method is present.
Why might a phone number not work for MFA?
Check that the number includes its country code and that the relevant SMS or voice authentication method is allowed by your organization's authentication methods policy. Also check for errors when adding the method.
What if my organization cannot use Conditional Access?
Check whether Microsoft Entra security defaults are suitable for your organization. Security defaults apply tenant-wide protections and require MFA registration, but they do not provide the same targeted policy controls as Conditional Access.




