Edit

Share via


New-EntraUser

Creates a Microsoft Entra ID user.

Syntax

Default (Default)

New-EntraUser

    -DisplayName <String>
    -AccountEnabled <Boolean>
    -PasswordProfile <PasswordProfile>
    [-City <String>]
    [-UserStateChangedOn <String>]
    [-CompanyName <String>]
    [-PreferredLanguage <String>]
    [-FaxNumber <String>]
    [-GivenName <String>]
    [-Mobile <String>]
    [-UsageLocation <String>]
    [-PostalCode <String>]
    [-AgeGroup <String>]
    [-CreationType <String>]
    [-ConsentProvidedForMinor <String>]
    [-MailNickName <String>]
    [-ImmutableId <String>]
    [-Country <String>]
    [-SignInNames <System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.SignInName]>]
    [-Department <String>]
    [-PasswordPolicies <String>]
    [-JobTitle <String>]
    [-UserState <String>]
    [-UserType <String>]
    [-OtherMails <System.Collections.Generic.List`1[System.String]>]
    [-UserPrincipalName <String>]
    [-State <String>]
    [-StreetAddress <String>]
    [-BusinessPhones <String>]
    [-Surname <String>]
    [-ShowInAddressList <Boolean>]
    [<CommonParameters>]

Description

The New-EntraUser cmdlet creates a user in Microsoft Entra ID. Specify the DisplayName,AccountEnabled, and PasswordProfile parameter to create a user.

Parameters

-AccountEnabled

Indicates whether the user's account is enabled.

Parameter properties

Type:System.Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AgeGroup

Specifies the user's age group.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BusinessPhones

Specifies a telephone number.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:TelephoneNumber

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-City

Specifies the user's city.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CompanyName

Specifies the user's company name.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ConsentProvidedForMinor

Sets whether consent was obtained for minors.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Country

Specifies the user's country.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CreationType

Indicates whether the user account is a local account for a Microsoft Entra ID B2C tenant. Possible values are "LocalAccount" and null.

  • When user creating a local account, the property is required and you must set it to "LocalAccount".
  • When user creating a work or school account, don't specify the property or set it to null.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Department

Specifies the user's department.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisplayName

Specifies the user's display name.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FaxNumber

Specifies the user's fax number.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:FacsimileTelephoneNumber, Fax

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GivenName

Specifies the user's given name.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ImmutableId

This property links an on-premises user account to its Microsoft Entra ID object and is required when creating a new user in Microsoft Graph if the user's userPrincipalName (UPN) is in a federated domain.

Important: The $ and _ characters can't be used when specifying this property.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-JobTitle

Specifies the user's job title.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MailNickName

Specifies the user's mail nickname.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Mobile

Specifies the user's mobile phone number.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OtherMails

A list of other email addresses for the user; for example: "bob@contoso.com", "Robert@fabrikam.com".

Parameter properties

Type:

System.Collections.Generic.List`1[System.String]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PasswordPolicies

Specifies password policies for the user. This value is an enumeration with one possible value being "DisableStrongPassword", which allows weaker passwords than the default policy to be specified. "DisablePasswordExpiration" can also be specified. The two might be specified together; for example: "DisablePasswordExpiration, DisableStrongPassword".

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PasswordProfile

Specifies the user's password profile.

The parameter type for this parameter is "PasswordProfile".

In order to pass a parameter of this type, you first need to create a variable in PowerShell with that type:

$passwordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile

Then you can proceed to set the value of the password in this variable:

$passwordProfile.Password = "<Password>"

And finally you can pass this variable to the cmdlet:

New-EntraUser -PasswordProfile $passwordProfile ...

Other attributes that can be set in the PasswordProfile are

  • $passwordProfile.EnforceChangePasswordPolicy - a boolean indicating that the change password policy is enababled or disabled for this user $passwordProfile.

  • ForceChangePasswordNextLogin - a boolean indicating that the user must change the password at the next sign in.

Parameter properties

Type:PasswordProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PostalCode

Specifies the user's postal code.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PreferredLanguage

Specifies the user's preferred language.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ShowInAddressList

If True, show this user in the address list.

Parameter properties

Type:System.Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SignInNames

Specifies the collection of sign-in names for a local account in a Microsoft Entra ID B2C tenant.

Each sign-in name must be unique across the company/tenant.

The property must be specified when you create a local account user; don't specify it when you create a work or school account.

Parameter properties

Type:

System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.SignInName]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-State

Specifies the user's state.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StreetAddress

Specifies the user's street address.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Surname

Specifies the user's surname.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UsageLocation

A two letter country code (ISO standard 3166).

Required for users that are assigned licenses due to legal requirement to check for availability of services in countries.

Examples include: "US", "JP", and "GB".

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UserPrincipalName

The user principal name (UPN) of the user.

The UPN is an Internet-style sign-in name for the user based on the Internet standard RFC 822.

By convention, this UPN should map to the user's email name.

The general format is "alias@domain".

For work or school accounts, the domain must be present in the tenant's collection of verified domains.

This property is required when a work or school account is created; it's optional for local accounts.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UserState

For an external user invited to the tenant using the invitation API, this property represents the invited user's invitation status.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UserStateChangedOn

Shows the timestamp for the latest change to the userState property.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UserType

A string value that can be used to classify user types in your directory, such as "Member" and "Guest".

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.