How to update a user in Azure AD using PowerShell scripts

User details in Azure Active Directory (Azure AD) may need to be updated in various scenarios to ensure accurate and secure identity and access management. When a user's personal information, contact information, or address information changes, we will have to update these in the Azure AD environment. If a user changes roles, departments within the organization, their details in Azure AD should be updated accordingly. Using the below PowerShell cmdlet, a user can be updated in Azure AD. ADManager Plus, a unified Active Directory, Microsoft 365, Exchange, and Google Workspace management and reporting tool, can also be used to accomplish this task.

The following table is a comparison on how to update a user in Azure AD using PowerShell scripts and ADManager Plus.

Azure PowerShell

Steps to update a user in Azure AD using PowerShell scripts:

  1. Note down the required parameters (ObjectId and the parameters that you want to modify) for updating a user.
  2. Execute the following PowerShell script with the required parameters and their values.
 Copied
Set-AzureADUser
-ObjectId <Id>
[-ExtensionProperty <System.Collections.Generic.Dictionary`2[System.String,System.String]>]
[-AccountEnabled <AccountEnabled>]
[-AgeGroup <AgeGroup>]
[-City <City>]
[-CompanyName <CompanyName>]
[-ConsentProvidedForMinor <ConsentProvidedForMinor>]
[-Country <Country>]
[-CreationType <CreationType>]
[-Department <Department>]
[-DisplayName <DisplayName>]
[-FacsimileTelephoneNumber <Ftelephonenumber>]
[-GivenName <GivenName>]
[-IsCompromised <IsCompromised>]
[-ImmutableId <Immutable>]
[-JobTitle <JobTitle>]
[-MailNickName <MailNickName>]
[-Mobile <Mobile>]
[-OtherMails <System.Collections.Generic.List`1[System.String]>]
[-PasswordPolicies <PasswordPolicies>]
[-PasswordProfile <PasswordProfile>]
[-PhysicalDeliveryOfficeName <DeliveryName>]
[-PostalCode <PstlCode>]
[-PreferredLanguage <Lang>]
[-ShowInAddressList <AddrList>]
[-SignInNames <System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.SignInName]>]
[-State <State>]
[-StreetAddress <StreetAddr>]
[-Surname <Surname>]
[-TelephoneNumber <TelNumber>]
[-UsageLocation <Loc>]
[-UserPrincipalName <PN>]
[-UserState <UserState>]
[-UserStateChangedOn <UserStateChangedOn>]
[-UserType <UserType>]
[<CommonParameters>]
Click to copy entire script

Run the above script for every user whose information you want to update.

With ADManager Plus:

Steps to update a user in Azure AD using ADManager Plus:

Log in to ADManager Plus and navigate to the Microsoft 365 tab > Management > User Management.

To modify users' address information:

  1. Under Bulk User Modification, click Modify user's address information.
  2. Select the desired Microsoft 365 tenant from the Microsoft 365 Tenant drop-down.
  3. Browse and select the CSV file containing the list of users whom you want to update, and click Import User(s).
  4. Select the desired users and click Apply.

To Modify users' contact details:

  1. Under Bulk User Modification, click Modify user's contact details.
  2. Select the desired Microsoft 365 tenant from the Microsoft 365 Tenant drop-down.
  3. Browse and select the CSV file containing the list of users whom you want to update, and click Import User(s).
  4. Select the desired users and click Apply.

To modify the naming attributes of a user:

  1. Under Bulk User Modification, click Modify Naming Attributes.
  2. Browse and select the CSV file containing the list of users whom you want to update, and click Import User(s).
  3. Select the desired users and click Apply.
How to update a user in Azure AD using PowerShell scripts
 

Limitations of using PowerShell scripts to update a user in Azure AD

  • Administrators must have sufficient permissions to modify attributes of Azure AD users if they wish to use the above-mentioned PowerShell script. However, one wrong move from the administrator can affect the security posture of your organization.
  • Only technicians with PowerShell expertise can execute this command.
  • PowerShell scripts are time-consuming and can affect productivity.
  • For each user, administrators should run the provided script individually to update their information.

Benefits of using ADManager Plus:

  • ADManager Plus's user management features streamlines user provisioning, modification, and deprovisioning processes, saving administrators time and effort.
  • ADManager Plus comes with an intuitive UI and does not demand extensive knowledge of PowerShell.
  • Management actions come built-in with ADManager Plus and can be performed at the click of a button.
  • ADManager Plus' automation feature reduces manual error and ensures consistency across the Active Directory environment.

Simplify Azure AD management and reporting with ADManager Plus

  Get 30-day free trial.
  • Embark on your script-free AD management, reporting, and automation journey with ADManager Plus.
  •  
  • By clicking 'Start your free trial now', you agree to processing of personal data according to the Privacy Policy.
  • Thanks
  • Your download should begin automatically in 15 seconds. If not, click here to download manually.

Related Powershell How-to Guides:

The one-stop solution toActive Directory Management and Reporting

Email Download Link