Skip to content

Create a User with Microsoft Graph

  1. Enter the following command to connect to Microsoft Graph:
Connect-MgGraph -scope User.ReadWrite.All
  1. Enter your admin credentials in the Sign in dialog box that appears
  2. You will/may need to grant permissions to edit Graph for your tenant - select Approve on behalf of the organization and then click Approve
  3. Connect to Microsoft Graph with the identity read/write permissions:
Connect-Graph -scope organization.readwrite.all
  1. Enter admin credentials and approve any requested permissions, if prompted
  2. You can set the -PasswordProfile parameter 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. 7. Create a new user account via the following command:

New-MgUser -DisplayName "Firstname Lastname" -PasswordProfile $PasswordProfile -AccountEnabled -MailNickName "FLastname" -UserPrincipalName FLastname@contoso.onmicrosoft.com
  1. Run the Get-MgUser command to view a list of users for your tenant, and look for the account you just created
  2. This can obviously be verified via the Azure AD/Entra ID admin center as well