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.
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.
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 "
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 -DisplayName "John Doe" -UserPrincipalName "john.doe@yourdomain.com" -MailNickname "john.doe" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled
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"
New-MgUser -DisplayName "Mark Johnson" -UserPrincipalName "mark.johnson@yourdomain.com" -MailNickname "mark.johnson" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled -Department "Sales" -OfficeLocation "Building 1"
New-MgUser -DisplayName "Alice Brown" -UserPrincipalName "alice.brown@yourdomain.com" -MailNickname "alice.brown" -PasswordProfile @{Password="Password123"; ForceChangePasswordNextSignIn=$true} -AccountEnabled -MobilePhone "+1234567890" -BusinessPhones @("+0987654321")
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