How to create Microsoft Entra ID users using New-MgUser

Creating Microsoft Entra ID users

User creation is a key task for IT admins, ensuring employees and external collaborators have secure access while managing access control and security policies. While Graph PowerShell's New-MgUser command—an alternative to the New-AzureADuser PowerShell command—can be used to create Microsoft Entra ID users, it is both a time-consuming and error-prone process, especially when dealing with a large volume of accounts or intricate organizational structures. On the other hand, ADManager Plus, a Microsoft 365 management and reporting tool, streamlines the task, enabling administrators to quickly create and manage Microsoft Entra ID users with just a few clicks.

  • ADManager Plus
  • PowerShell
 

Steps to create Microsoft Entra ID users using ADManager Plus

  1. Log in to ADManager Plus and navigate to Management > User Management.
  2. Under User Creation, click Create Single User.
  3. Select the desired domain in which you would like to create users from the Selected Domain drop-down list.
  4. Select the Microsoft 365 check box.
  5. Fill in the required details and click Create.
Create Microsoft Entra ID users using ADManager Plus
 
 

Apply templates to automatically configure multiple user attributes in one step.

 
 

Copy values from an existing user account to fill template fields.

Create Microsoft Entra ID users using Microsoft Graph PowerShell

Prerequisites

Before using the New-MgUser cmdlet, ensure the following:

  • The Microsoft Graph PowerShell module is installed. If not, install it using this script:
    Install-Module Microsoft.Graph -Scope CurrentUser
  • Connect to Microsoft Graph PowerShell with the following permissions to create Microsoft Entra ID users.
    User.ReadWrite.All, Directory.ReadWrite.All,
    DeviceManagementServiceConfig.ReadWrite.All,
    DeviceManagementManagedDevices.ReadWrite.All,
    DeviceManagementConfiguration.ReadWrite.All,
    DeviceManagementApps.ReadWrite.All,

Using the New-MgUser command to create Microsoft Entra ID users

The New-MgUser cmdlet can be used in Microsoft Graph PowerShell to create Microsoft Entra ID users. Here's the syntax:

New-MgUser
[-ResponseHeadersVariable <String>]
[-AboutMe <String>]
[-AccountEnabled]
[-Activities <IMicrosoftGraphUserActivity[]>]
[-AdditionalProperties <Hashtable>]
[-AgeGroup <String>]
[-AgreementAcceptances <IMicrosoftGraphAgreementAcceptance[]>]
[-AppRoleAssignments <IMicrosoftGraphAppRoleAssignment[]>]
[-AssignedLicenses <IMicrosoftGraphAssignedLicense[]>]
[-AssignedPlans <IMicrosoftGraphAssignedPlan[]>]
[-Authentication <IMicrosoftGraphAuthentication>]
[-AuthorizationInfo <IMicrosoftGraphAuthorizationInfo>]
[-Birthday <DateTime>]
[-BusinessPhones <String[]>]
[-Calendar <IMicrosoftGraphCalendar>]
[-CalendarGroups <IMicrosoftGraphCalendarGroup[]>]
[-CalendarView <IMicrosoftGraphEvent[]>]
[-Calendars <IMicrosoftGraphCalendar[]>]
[-Chats <IMicrosoftGraphChat[]>]
[-City <String>]
[-CloudClipboard <IMicrosoftGraphCloudClipboardRoot>]
[-CompanyName <String>]
[-ConsentProvidedForMinor <String>]
[-ContactFolders <IMicrosoftGraphContactFolder[]>]
[-Contacts <IMicrosoftGraphContact[]>]
[-Country <String>]
[-CreatedDateTime <DateTime>]
[-CreatedObjects <IMicrosoftGraphDirectoryObject[]>]
[-CreationType <String>]
[-CustomSecurityAttributes <Hashtable>]
[-DeletedDateTime <DateTime>]
[-Department <String>]
[-DeviceEnrollmentLimit <Int32>]
[-DeviceManagementTroubleshootingEvents <IMicrosoftGraphDeviceManagementTroubleshootingEvent[]>]
[-DirectReports <IMicrosoftGraphDirectoryObject[]>]
[-DisplayName <String>]
[-Drive <IMicrosoftGraphDrive>]
[-Drives <IMicrosoftGraphDrive[]>]
[-EmployeeExperience <IMicrosoftGraphEmployeeExperienceUser>]
[-EmployeeHireDate <DateTime>]
[-EmployeeId <String>]
[-EmployeeLeaveDateTime <DateTime>]
[-EmployeeOrgData <IMicrosoftGraphEmployeeOrgData>]
[-EmployeeType <String>]
[-Events <IMicrosoftGraphEvent[]>]
[-Extensions <IMicrosoftGraphExtension[]>]
[-ExternalUserState <String>]
[-ExternalUserStateChangeDateTime <DateTime>]
[-FaxNumber <String>]
[-FollowedSites <IMicrosoftGraphSite[]>]
[-GivenName <String>]
[-HireDate <DateTime>]
[-Id <String>]
[-Identities <IMicrosoftGraphObjectIdentity[]>]
[-ImAddresses <String[]>]
[-InferenceClassification <IMicrosoftGraphInferenceClassification>]
[-Insights <Hashtable>]
[-Interests <String[]>]
[-IsManagementRestricted]
[-IsResourceAccount]
[-JobTitle <String>]
[-JoinedTeams <IMicrosoftGraphTeam[]>]
[-LastPasswordChangeDateTime <DateTime>]
[-LegalAgeGroupClassification <String>]
[-LicenseAssignmentStates <IMicrosoftGraphLicenseAssignmentState[]>]
[-LicenseDetails <IMicrosoftGraphLicenseDetails[]>]
[-Mail <String>]
[-MailFolders <IMicrosoftGraphMailFolder[]>]
[-MailNickname <String>]
[-MailboxSettings <IMicrosoftGraphMailboxSettings>]
[-ManagedAppRegistrations <IMicrosoftGraphManagedAppRegistration[]>]
[-ManagedDevices <IMicrosoftGraphManagedDevice[]>]
[-Manager <IMicrosoftGraphDirectoryObject>]
[-MemberOf <IMicrosoftGraphDirectoryObject[]>]
[-Messages <IMicrosoftGraphMessage[]>]
[-MobilePhone <String>]
[-MySite <String>]
[-Oauth2PermissionGrants <IMicrosoftGraphOAuth2PermissionGrant[]>]
[-OfficeLocation <String>]
[-OnPremisesDistinguishedName <String>]
[-OnPremisesDomainName <String>]
[-OnPremisesExtensionAttributes <IMicrosoftGraphOnPremisesExtensionAttributes>]
[-OnPremisesImmutableId <String>]
[-OnPremisesLastSyncDateTime <DateTime>]
[-OnPremisesProvisioningErrors <IMicrosoftGraphOnPremisesProvisioningError[]>]
[-OnPremisesSamAccountName <String>]
[-OnPremisesSecurityIdentifier <String>]
[-OnPremisesSyncEnabled]
[-OnPremisesUserPrincipalName <String>]
[-Onenote <IMicrosoftGraphOnenote>]
[-OnlineMeetings <IMicrosoftGraphOnlineMeeting[]>]
[-OtherMails <String[]>]
[-Outlook <IMicrosoftGraphOutlookUser>]
[-OwnedDevices <IMicrosoftGraphDirectoryObject[]>]
[-OwnedObjects <IMicrosoftGraphDirectoryObject[]>]
[-PasswordPolicies <String>]
[-PasswordProfile <IMicrosoftGraphPasswordProfile>]
[-PastProjects <String[]>]
[-People <IMicrosoftGraphPerson[]>]
[-PermissionGrants <IMicrosoftGraphResourceSpecificPermissionGrant[]>]
[-Photo <IMicrosoftGraphProfilePhoto>]
[-Photos <IMicrosoftGraphProfilePhoto[]>]
[-Planner <IMicrosoftGraphPlannerUser>]
[-PostalCode <String>]
[-PreferredDataLocation <String>]
[-PreferredLanguage <String>]
[-PreferredName <String>]
[-Presence <IMicrosoftGraphPresence>]
[-Print <IMicrosoftGraphUserPrint>]
[-ProvisionedPlans <IMicrosoftGraphProvisionedPlan[]>]
[-ProxyAddresses <String[]>]
[-RegisteredDevices <IMicrosoftGraphDirectoryObject[]>]
[-Responsibilities <String[]>]
[-Schools <String[]>]
[-ScopedRoleMemberOf <IMicrosoftGraphScopedRoleMembership[]>]
[-SecurityIdentifier <String>]
[-ServiceProvisioningErrors <IMicrosoftGraphServiceProvisioningError[]>]
[-Settings <IMicrosoftGraphUserSettings>]
[-ShowInAddressList]
[-SignInActivity <IMicrosoftGraphSignInActivity>]
[-SignInSessionsValidFromDateTime <DateTime>]
[-Skills <String[]>]
[-Solutions <IMicrosoftGraphUserSolutionRoot>]
[-Sponsors <IMicrosoftGraphDirectoryObject[]>]
[-State <String>]
[-StreetAddress <String>]
[-Surname <String>]
[-Teamwork <IMicrosoftGraphUserTeamwork>]
[-Todo <IMicrosoftGraphTodo>]
[-TransitiveMemberOf <IMicrosoftGraphDirectoryObject[]>]
[-UsageLocation <String>]
[-UserPrincipalName <String>]
[-UserType <String>]
[-Headers <IDictionary>]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]<
[<CommonParameters>]

Example use cases and scripts using the New-MgUser cmdlet

Create a new user

$PasswordProfile = @{
Password = 'xWwvJ]6NMw+bWH-d'
}
New-MgUser -DisplayName 'Rene Magi' -PasswordProfile $PasswordProfile -AccountEnabled -MailNickName 'ReneMagi' -UserPrincipalName 'ReneMagi@contoso.com'

Supported parameters

The following table contains some parameters that can be used along with the New-MgUser command to efficiently create Microsoft Entra ID users.

Parameters Description
-AccountEnabled This parameter determines if the user account is enabled or not.
-Activities This parameter displays the user's activities across devices.
-AgeGroup This parameter sets the age group of the user.
-AppRoleAssignments This parameter represents the app roles a user is granted for an application.
-AssignedLicenses This parameter determines the licenses that are to be assigned to the user.

Limitations of using Graph PowerShell scripts to create Microsoft Entra ID users

  • Graph PowerShell requires IT admins to upgrade from Azure AD PowerShell and have familiarity with PowerShell scripting.
  • The Microsoft Graph API imposes throttling limits, which may affect performance when creating users in bulk.
  • Identifying and troubleshooting errors in large-scale user creation scripts can be time-consuming and require technical expertise.
  • The scripts may require extra effort to format and export data for reporting purposes.
  • No built-in graphical interface or user-friendly reports, making management and monitoring difficult for administrators.

Highlights of using ADManager Plus to create Microsoft Entra ID users

  • Simplifies user creation and management with a user-friendly interface, eliminating the need for PowerShell scripting or Graph API knowledge.
  • Simplify bulk operations through automation capabilities, optimizing large-scale environments, and eliminating the need for complex scripts.
  • Use prebuilt or custom templates to standardize management and reporting tasks.
  • Generate more than 200 prepackaged reports, with options to customize and export them in various formats, like CSV or HTML.
  • Delegate specific management and reporting tasks to technicians without granting them excessive permissions.

Simplify Microsoft Entra ID user creation with ADManager Plus

 
  • Create Microsoft Entra ID users using ADManager Plus
  • Create Microsoft Entra ID users using Microsoft Graph PowerShell
  • Limitations of using Graph PowerShell scripts to create Microsoft Entra ID users
  • Highlights of using ADManager Plus to create Microsoft Entra ID users
The one-stop solution to Active Directory Management and Reporting
Email Download Link