New-MgUser – M365 Glossary

What is New-MgUser?

New-MgUser is a Microsoft Graph PowerShell cmdlet that allows administrators to create new user accounts in Microsoft 365 (Entra ID/Azure AD). It offers flexibility to define user details such as display name, username, password, department, job title, contact information, and more—all in a single command.


Why Use New-MgUser?

Using New-MgUser streamlines user onboarding by automating account creation. Instead of manually filling out forms in the Microsoft 365 admin center, you can script user creation—making bulk onboarding faster, reducing human error, and ensuring consistent configurations across accounts. This automation is especially beneficial for organizations handling frequent new hires or managing large user bases.


Prerequisites

Before using New-MgGroup, ensure you have the Microsoft Graph PowerShell module installed and the necessary permissions granted.

Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.ReadWrite.All "

How to Use New-MgUser?

Syntax (Essential Parameters)

New-MgUser -DisplayName <String> -UserPrincipalName <String> -MailNickname <String> -PasswordProfile <Hashtable> -AccountEnabled

At a minimum, you must specify the display name, UPN, mail nickname, password profile (with password and reset requirement), and account status. You can also include additional properties to enrich the profile during creation.


New-MgUser Examples

  • Basic User Creation
  • New-MgUser -DisplayName "John Doe" -UserPrincipalName "john.doe@yourdomain.com" -MailNickname "john.doe" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled
  • Creating a User with Additional Profile Information
  • New-MgUser -DisplayName "Jane Smith" -UserPrincipalName "jane.smith@yourdomain.com" -MailNickname "jane.smith" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled  -GivenName "Jane" -Surname "Smith" -JobTitle "Marketing Manager"
  • Creating a User with Department and Office Location
  • New-MgUser -DisplayName "Mark Johnson" -UserPrincipalName "mark.johnson@yourdomain.com" -MailNickname "mark.johnson" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled  -Department "Sales" -OfficeLocation "Building 1"
  • Creating a User with Mobile Phone and Other Contact Information
  • New-MgUser -DisplayName "Alice Brown" -UserPrincipalName "alice.brown@yourdomain.com" -MailNickname "alice.brown" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled  -MobilePhone "+1234567890" -BusinessPhones @("+0987654321")
  • Creating a User with Usage Location and Preferred Language
  • New-MgUser -DisplayName "Tom Wilson" -UserPrincipalName "tom.wilson@yourdomain.com" -MailNickname "tom.wilson" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled  -UsageLocation "US" -PreferredLanguage "en-US"

Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.

Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.

© Your Site Name. All Rights Reserved. Design by HTML Codex