Usage
m365 aad user add [options]
Description
Creates a new user
Options
| Option |
Description |
--accountEnabled [accountEnabled] |
Whether the account is enabled. Possible values: true, false. Default value is true. |
--displayName <displayName> |
The name to display in the address book for the user. |
--mailNickname [mailNickname] |
The mail alias for the user. By default this value will be extracted from userName. |
--userName <userName> |
The user principal name ([email protected]). |
--password [password] |
The password for the user. When not specified, a password will be generated. |
--firstName [firstName] |
The given name (first name) of the user. Maximum length is 64 characters. |
--lastName [lastName] |
The user's surname (family name or last name). Maximum length is 64 characters. |
--forceChangePasswordNextSignIn |
Whether the user should change his/her password on the next login. |
--forceChangePasswordNextSignInWithMfa |
Whether the user should change his/her password on the next login and setup MFA. |
--usageLocation [usageLocation] |
A two letter country code (ISO standard 3166). Required for users that will be assigned licenses. |
--officeLocation [officeLocation] |
The office location in the user's place of business. |
--jobTitle [jobTitle] |
The user's job title. Maximum length is 128 characters. |
--companyName [companyName] |
The company name which the user is associated. The maximum length is 64 characters. |
--department [department] |
The name for the department in which the user works. Maximum length is 64 characters. |
--preferredLanguage [preferredLanguage] |
The preferred language for the user. Should follow ISO 639-1 Code. Example: en-US. |
--managerUserId [managerUserId] |
User ID of the user's manager. Specify managerUserId or managerUserName but not both. |
--managerUserName [managerUserName] |
User principal name of the manager. Specify managerUserId or managerUserName but not both. |
Examples
Create a user and let him/her update the password at first login
m365 aad user add --displayName "John Doe" --userName "[email protected]" --password "$@feP@$$w0rd" --forceChangePasswordNextSignIn
Create a user with job information
m365 aad user add --displayName "John Doe" --userName "[email protected]" --password "$@feP@$$w0rd" --firstName John --lastName Doe --jobTitle "Sales Manager" --companyName Contoso --department Sales
Create a user with language information
m365 aad user add --displayName "John Doe" --userName "[email protected]" --password "$@feP@$$w0rd" --preferredLanguage "nl-BE" --usageLocation BE
Default properties
No response
Additional Info
API reference: https://learn.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http
Let's specify in the docs which roles you need to remove a user:
- User Administrator
- Privileged Authentication Administrator
- Global Administrator
There are many more user profile properties we can set, but it's unrealistic to provide all options possible. If I missed some useful properties, feel free to add them.
Usage
m365 aad user add [options]
Description
Creates a new user
Options
--accountEnabled [accountEnabled]true,false. Default value is true.--displayName <displayName>--mailNickname [mailNickname]userName.--userName <userName>--password [password]--firstName [firstName]--lastName [lastName]--forceChangePasswordNextSignIn--forceChangePasswordNextSignInWithMfa--usageLocation [usageLocation]--officeLocation [officeLocation]--jobTitle [jobTitle]--companyName [companyName]--department [department]--preferredLanguage [preferredLanguage]en-US.--managerUserId [managerUserId]managerUserIdormanagerUserNamebut not both.--managerUserName [managerUserName]managerUserIdormanagerUserNamebut not both.Examples
Create a user and let him/her update the password at first login
Create a user with job information
Create a user with language information
Default properties
No response
Additional Info
API reference: https://learn.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http
Let's specify in the docs which roles you need to remove a user:
There are many more user profile properties we can set, but it's unrealistic to provide all options possible. If I missed some useful properties, feel free to add them.