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
    
  2. Enter your admin credentials in the Sign in dialog box that appears

  3. You will/may need to grant permissions to edit Graph for your tenant - select Approve on behalf of the organization and then click Approve

  4. Connect to Microsoft Graph with the identity read/write permissions:

    Connect-Graph -scope organization.readwrite.all
    
  5. Enter admin credentials and approve any requested permissions, if prompted

  6. 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
    
  8. Run the Get-MgUser command to view a list of users for your tenant, and look for the account you just created