Update Mobile Numbers for Microsoft 365 Users via PowerShell

Created by Rohit Yadav, Modified on Fri, 26 Sep at 12:46 PM by Rohit Yadav

Purpose

This article explains how to update mobile numbers for multiple Microsoft 365 users using a PowerShell script. It also shows how to check update status (Success/Failed) directly in the PowerShell console.


Prerequisites

  • Microsoft Graph PowerShell module installed

    Install-Module Microsoft.Graph -Scope AllUsers
  • Administrator account with the following Microsoft Graph API permissions:

    • User.ReadWrite.All

    • Directory.ReadWrite.All

  • A CSV file containing users and their new mobile numbers.

Example Mobile Number Update.csv:

UserPrincipalName,Mobile rohit@domain.com,+919876543210 kamal@domain.com,+918888888888

Steps to Run

1. Connect to Microsoft Graph

Open PowerShell as Administrator and run:

Disconnect-MgGraph Connect-MgGraph -Scopes "User.Read.All","User.ReadWrite.All","Directory.Read.All","Directory.ReadWrite.All" Select-MgProfile -Name beta

2. Save Script

Save the following script as Update-MobileNumbers.ps1:

# Input CSV path $csvPath = "C:\Users\<YourUser>\OneDrive\Desktop\Mobile Number Update.csv" # Process each user and show status in console only Import-Csv $csvPath | ForEach-Object { try { Update-MgUser -UserId $_.UserPrincipalName -MobilePhone $_.Mobile -ErrorAction Stop Write-Host "✅ Success: $($_.UserPrincipalName) → $($_.Mobile)" -ForegroundColor Green } catch { Write-Host "❌ Failed: $($_.UserPrincipalName) → $($_.Mobile)" -ForegroundColor Red Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Yellow } }

3. Run the Script

.\Update-MobileNumbers.ps1

Expected Output

  • Success messages appear in green

  • Failure messages appear in red

  • Errors are displayed in yellow with details

Example:

✅ Success: rohit@domain.com → +919876543210 ❌ Failed: kamal@domain.com → +918888888888 Error: Property is read-only for AD-synced users

Notes

  • If a user is AD-synced (hybrid environment), the mobile number cannot be updated via Microsoft 365. You must update it in Active Directory and then run a sync.

  • For cloud-only users, updates will apply immediately.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article