New-MsolUser
Updated: July 30, 2015
Applies To: Azure, Office 365, Windows Intune
Note
- The cmdlets were previously known as the Microsoft Online Services Module for Windows PowerShell cmdlets.
The New-MsolUser cmdlet is used to create a new user in the . In order to give the user access to services, they must also be assigned a license (using the LicenseAssignment parameter).
Syntax
New-MsolUser -DisplayName <string> -UserPrincipalName <string> [-AlternateEmailAddresses <string[]>] [-BlockCredential <Boolean>] [-City <string>] [-Country <string>] [-Department <string>] [-Fax <string>] [-FirstName <string>] [-ForceChangePassword <Boolean>] [-ImmutableId <string>] [-LastName <string>] [-LicenseAssignment <string[]>] [-LicenseOptions <LicenseOption[]>] [-MobilePhone <string>] [-Office <string>] [-Password <string>] [-PasswordNeverExpires <Boolean>] [-PhoneNumber <string>] [-PostalCode <string>] [-PreferredLanguage <string>] [-State <string>] [-StreetAddress <string>] [-StrongPasswordRequired <Boolean>] [-TenantId <Guid>] [-Title <string>] [-UsageLocation <string>] [<CommonParameters>]
Parameters
-AlternateEmailAddresses <string[]>
The alternate email addresses of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-BlockCredential <Boolean>
When true, the user will not be able to log on using their user ID.
Required? false
Position? named
Default value $false
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-City <string>
The city of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Country <string>
The country of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Department <string>
The department of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-DisplayName <string>
The display name of the user.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Fax <string>
The fax number of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-FirstName <string>
The first name of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-ForceChangePassword <Boolean>
When true, the user will be required to change their password the next
time they sign in.
Required? false
Position? named
Default value $true
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-ImmutableId <string>
The immutable ID of the user's federated identity. This should be
omitted for users with standard identities.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-LastName <string>
The last name of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-LicenseAssignment <string[]>
List of licenses to assign the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-LicenseOptions <LicenseOption[]>
License options for license assignment. Used to selectively disable
individual service plans within a SKU.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-MobilePhone <string>
The mobile phone number of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Office <string>
The office of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Password <string>
The new password for the user. If the user is set to require a strong
password, then all of the following rules must be met:
- The password must contain at least one lowercase letter
- The password must contain at least one uppercase letter
- The password must contain at least one non-alphanumeric character
- The password cannot contain any spaces, tabs, or line breaks
- The length of the password must be 8-16 characters
- The user name cannot be contained in the password
If this value is omitted, then a random password will be assigned to
the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-PasswordNeverExpires <Boolean>
Sets whether or not the user's password will expire periodically.
Required? false
Position? named
Default value $false
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-PhoneNumber <string>
The phone number of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-PostalCode <string>
The postal code of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-PreferredLanguage <string>
The preferred language of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-State <string>
The state where the user is located.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-StreetAddress <string>
The street address of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-StrongPasswordRequired <Boolean>
Sets whether or not the user requires a strong password.
Required? false
Position? named
Default value $true
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-TenantId <Guid>
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Title <string>
The title of the user.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-UsageLocation <string>
The location of the user where services are consumed. Must be a
two-letter country code.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-UserPrincipalName <string>
The user ID for this user. This is required.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".
Examples
Output is provided by Microsoft.Online.Administration.User. This cmdlet returns details about the new user that was created, including their temporary password (if one is not specified).
If the user is set to require a strong password, then all of the following rules must be met:
The password must contain at least one lowercase letter.
The password must contain at least one uppercase letter.
The password must contain at least one non-alphanumeric character.
The password cannot contain any spaces, tabs, or line breaks.
The length of the password must be 8-16 characters.
The user name cannot be contained in the password.
If the password value is omitted, then a random password is assigned to the user.
Example 1
The following command creates a new user. The user will not have any licenses assigned. A random password will be generated for the user.
New-MsolUser -UserPrincipalName JWarner@contoso.com -DisplayName "Jamie Warner" -FirstName "Jamie" -LastName "Warner"
Example 2
The follow command creates a new user and assigns the user a license.
New-MsolUser -UserPrincipalName DomTru@contoso.com -DisplayName " Dominique Trujillo" -FirstName "Dominique " -LastName "Trujillo" -UsageLocation "US" -LicenseAssignment "Contoso:BPOS_Standard"
Additional Resources
There are several other places you can get more information and help. These include: