Users: New

Create a new User using Microsoft Graph.

PowerShell

Connect-MgGraph -Scopes @('User.ReadWrite.All')
$displayName = '<Firstname, Lastname>'
$domain = '<Verified Domain>'
$userPrincipalName = '<Preferred Suffix>' + '@' + $domain
$mailNickname = $userPrincipalName.Split('@')[0]
$changePassword = $false
$accountEnabled = $true
$passwordProfile = @{
    Password                      = 'xWwvJ]6NMw+bWH-d'; #Auto-Generate this value
    ForceChangePasswordNextSignIn = $changePassword
}
# Minimum attributes required.
$params = @{
    'DisplayName'       = $displayName;
    'AccountEnabled'    = $accountEnabled;
    'PasswordProfile'   = $passwordProfile;
    'UserPrincipalName' = $userPrincipalName;
    'MailNickname'      = $mailNickname;
}
New-MgUser @params

Dependencies

Microsoft Graph SDK for PowerShell

Install-Module Microsoft.Graph -AllowClobber -Force

Connect-MgGraph

Using the Microsoft Graph Command Line Tools Enterprise Application:

Connect-MgGraph -Scopes @('')

Using an existing Access Token:

Connect-MgGraph -AccessToken (ConvertTo-SecureString 'ey..' -AsPlainText -Force)

Using an Application Registration (Platform: Mobile and desktop applications, redirect http://localhost):

Connect-MgGraph -ClientId 'abc..' -TenantId 'abc..'

Using a ClientId and Secret (Password):

$tenantId = ''
$clientId = ''
$secret = ConvertTo-SecureString '' -AsPlainText -Force
$secretCredential = New-Object System.Management.Automation.PSCredential ($clientId, $secret)
$params = @{
    'SecretCredential' = $secretCredential
    'TenantId'         = $tenantId
}
Connect-MgGraph @params