Create a User with Microsoft Graph
-
Enter the following command to connect to Microsoft Graph:
Connect-MgGraph -scope User.ReadWrite.All -
Enter your admin credentials in the Sign in dialog box that appears
-
You will/may need to grant permissions to edit Graph for your tenant - select Approve on behalf of the organization and then click Approve
-
Connect to Microsoft Graph with the identity read/write permissions:
Connect-Graph -scope organization.readwrite.all -
Enter admin credentials and approve any requested permissions, if prompted
-
You can set the
-PasswordProfileparameter as a variable to make the user creation process quicker, if desired:$PasswordProfile = @{ Password = "Pa55w.rd12341234!" ForceChangePasswordNextSignIn = $false ForceChangePasswordNextSignInWithMfa = $false}This will set the user's password as
Pa55w.rd12341234!and will NOT force a password change on their next sign in. -
Create a new user account via the following command:
New-MgUser -DisplayName "Firstname Lastname" -PasswordProfile $PasswordProfile -AccountEnabled -MailNickName "FLastname" -UserPrincipalName FLastname@contoso.onmicrosoft.com -
Run the
Get-MgUsercommand to view a list of users for your tenant, and look for the account you just created- This can obviously be verified via the Azure AD/Entra ID admin center as well