Skip to main content

entra user set

Updates information of the specified user

Usage

m365 entra user set [options]

Alias

m365 aad user set [options]

Options

-i, --id [id]

The object ID of the user to update. Specify id or userName but not both.

-n, --userName [userName]

User principal name of the user to update. Specify id or userName but not both.

--accountEnabled [accountEnabled]

Boolean value specifying whether the account is enabled. Valid values are true or false.

--resetPassword

If specified, the password of the user will be reset. This will make the parameter newPassword required.

--forceChangePasswordNextSignIn

If specified, the user will have to change his password the next time they log in. Can only be set in combination with resetPassword.

--forceChangePasswordNextSignInWithMfa

Whether the user should change his/her password on the next login and setup MFA. Can only be set in combination with resetPassword.

--currentPassword [currentPassword]

Current password of the user that is signed in. If this parameter is set, newPassword is mandatory. Can't be combined with resetPassword.

--newPassword [newPassword]

New password to be set. Must be set when specifying either resetPassword or currentPassword.

--displayName [displayName]

The name to display in the address book for the user.

--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.

--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, managerUserName or removeManager but not both.

--managerUserName [managerUserName]

User principal name of the manager. Specify managerUserId, managerUserName or removeManager but not both.

--removeManager

Remove currently set manager. The user will have no manager when this flag is set. Specify managerUserId, managerUserName or removeManager but not both.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

This command allows using unknown options. For a comprehensive list of user properties, please refer to the Graph documentation page.

If the user with the specified ID or username doesn't exist, or if the specified option is not found, you will receive a Resource 'xyz' does not exist or one of its queried reference-property objects are not present. error.

Examples

Update specific property department of user with id 1caf7dcd-7e83-4c3a-94f7-932a1299c844

m365 entra user set --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --department IT

Update multiple properties of user by name

m365 entra user set --userName steve@contoso.onmicrosoft.com --firstName John --lastName Doe --jobTitle "Sales Manager" --companyName Contoso --department Sales --officeLocation "New York"

Enable user with id 1caf7dcd-7e83-4c3a-94f7-932a1299c844

m365 entra user set --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --accountEnabled true

Disable user with id 1caf7dcd-7e83-4c3a-94f7-932a1299c844

m365 entra user set --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --accountEnabled false

Reset password of a given user by userName and require the user to change the password on the next sign in

m365 entra user set --userName steve@contoso.onmicrosoft.com --resetPassword --newPassword 6NLUId79Lc24 --forceChangePasswordNextSignIn

Change password of the currently logged in user

m365 entra user set --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --currentPassword SLBF5gnRtyYc --newPassword 6NLUId79Lc24

Updates a user with a manager

m365 entra user set --displayName "John Doe" --userName "john.doe@contoso.com" --managerUserName "adele@contoso.com"

Updates a user by removing its manager

m365 entra user set --userName "john.doe@contoso.com" --removeManager

Response

The command won't return a response on success.

CTRL + M