New-AzureRmADUser

Creates a new active directory user.

Syntax

New-AzureRmADUser
   -DisplayName <String>
   -UserPrincipalName <String>
   -Password <SecureString>
   [-ImmutableId <String>]
   [-MailNickname <String>]
   [-ForceChangePasswordNextLogin]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Creates a new active directory user (work/school account also popularly known as org-id). For more information: https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations#CreateUser

Examples

Example 1 - Create a new AD user

PS C:\> $SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
PS C:\> New-AzureRmADUser -DisplayName "MyDisplayName" -UserPrincipalName "myemail@domain.com" -Password $SecureStringPassword -MailNickname "MyMailNickName"

Creates a new AD user with the name "MyDisplayName" and user principal name "myemail@domain.com" in a tenant.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisplayName

The name to display in the address book for the user. example 'Alex Wu'.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ForceChangePasswordNextLogin

It must be specified if the user must change the password on the next successful login (true). Default behavior is (false) to not change the password on the next successful login.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ImmutableId

It needs to be specified only if you are using a federated domain for the user's user principal name (upn) property.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-MailNickname

The mail alias for the user.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Password

Password for the user. It must meet the tenant's password complexity requirements. It is recommended to set a strong password.

Type:SecureString
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-UserPrincipalName

The user principal name. Example-'someuser@contoso.com'.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

SecureString

SwitchParameter

Outputs

Microsoft.Azure.Graph.RBAC.Version1_6.ActiveDirectory.PSADUser