Close Menu
    Facebook X (Twitter) Instagram
    Sunday, October 12
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»Office 365»Azure Active Directory»Using Powershell to update Azure authentication method – phone number

    Using Powershell to update Azure authentication method – phone number

    Eswar KonetiBy Eswar KonetiOctober 16, 8:16 pm2 Mins Read Azure Active Directory 5,813 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Azure AD Multi-Factor Authentication (MFA) works by requiring two or more authentication methods for a user to gain access to applications.

    Multi-factor authenticator in Azure AD can be set using different methods such as Microsoft Authenticator, Phone number, Email  etc.

    One of the easiest MFA methods that doesn't require any user configuration and can be configured in the backend is Phone Number.

    With phone number as an authentication method, users can choose to receive a text message with a verification code to enter in the sign-in interface or receive a phone call.

    To read more information about how Azure AD multi-factor authentication works, refer here

    I was recently working a project for Frontline workers enable the MFA for all users and use the phone number as 2nd-factor authentication.

    Updating the phone number for few users can be done using the Azure AD portal by visiting a user, go to the authentication method and add phone number.

    image

    image

    If you want to update the phone numbers for bulk users, manual is not the way forward.we can use Powershell to automate the process of updating the phone number for all users.

    We will use Microsoft Graph API to update the phone number (mobile) for all users using Powershell script.

    The Powershell script does the following

    1. Read the CSV file (UPN and phone number)

    2. Check if the UPN exist or not , write to output log.

    3.Check if the user has phone number exist (at least one).

    4. If no phone number exist, update the phone number, write to output log

    5.If the user has phone number exist, write to output log.

    This script requires 2 modules to be installed, a) Microsoft Graph 2) Azure AD

    output log:

    image

    Download the Powershell script which contains the CSV file and ps script from Github here.

    Reference https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.identity.signins/new-mguserauthenticationphonemethod?view=graph-powershell-1.0

    API authentication methods azure Azure AD frontline workers MFA Microsoft Graph phone number phoneAuthenticationMethod Signins
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Export Microsoft Entra ID User Authentication Methods to CSV using PowerShell & Microsoft Graph API

    August 13, 2:08 pm

    Exporting Intune Win32 Apps with All Properties Using PowerShell and Microsoft Graph

    June 30, 7:01 pm

    Troubleshooting Windows Hello for Business PIN Reset Issues – Something went wrong

    March 06, 9:48 pm

    4 Comments

    1. JaCzu on October 29, 2023 12:32 AM

      Thanks. It works really well.

      Reply
    2. M on September 20, 2023 12:42 AM

      Sadly this script doesn't work

      Reply
    3. Yogesh Patil on January 9, 2023 7:47 PM

      Getting below error after running the script.
      User test.user8@oracle.com doesnt exist, please check
      ----------------Script ended at 09-01-2023-050120------------------
      ----------------Script started at 09-01-2023-050549------------------

      Can you please help

      Reply
      • Eswar Koneti on March 12, 2023 2:49 AM

        can you check if the user exist? does the script for any user? are you able to fetech the users manually using the following script line?

        Repalce: Get-AzureADUser -SearchString $upn
        with:Get-AzureADUser -objectid $upn

        Regards,
        Eswar

        Reply

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2025 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.