New-AzADUser

In this Azure PowerShell article, we will discuss the syntax and usage of the New-AzADUser PowerShell command with certain examples.

Table of Contents

New-AzADUser

This PowerShell command can help you to create a new Azure AD user.

Syntax

Below is the syntax of the New-AzADUser PowerShell command.

New-AzADUser
 -DisplayName <String>
 -MailNickname <String>
   -UserPrincipalName <String>
 -Password <SecureString>
New-AzADUser
 -DisplayName <String>
 -MailNickname <String>
   -UserPrincipalName <String> -PasswordProfile <IMicrosoftGraphPasswordProfile>

Let’s discuss an example of how to use the New-AzADUser PowerShell command.

Example

You can execute the below PowerShell command to create a new Azure AD user with a Password.

$mynickname = "AzureLessonsUser"
$myuname = "AzureLessons User"
$upname = "AzureLessonsUser@fewlines4bijuhotmail.onmicrosoft.com"
$mypswd = "XXXXX@XXX"
$mypswd = ConvertTo-SecureString -AsPlainText -Force $mypswd
New-AzADUser -DisplayName $myuname -Password $mypswd -AccountEnabled $true -MailNickname $mynickname -UserPrincipalName $upname

After executing the above PowerShell command, I got the below-expected output and the Azure AD user has been created successfully.

DisplayName       Id                                   Mail UserPrincipalName                                    
-----------       --                                   ---- -----------------                                    
AzureLessons User c2df0bca-215e-4144-bfd1-807be7ddf81d      AzureLessonsUser@fewlines4bijuhotmail.onmicrosoft.com

You can see the same output in the below screenshot.

New-AzADUser

Conclusion

In this Azure PowerShell article, we discussed we will discuss the syntax and usage of the New-AzADUser PowerShell command with certain examples. Thanks for reading this article !!!