aad user set¶
Updates information of the specified user
Usage¶
m365 aad user set [options]
Options¶
-i, --objectId [objectId]
- The object ID of the user to update. Specify
objectId
oruserPrincipalName
but not both -n, --userPrincipalName [userPrincipalName]
- User principal name of the user to update. Specify
objectId
oruserPrincipalName
but not both --accountEnabled [accountEnabled]
- Boolean value specifying whether the account is enabled. Valid values are
true,false
-h, --help
- output usage information
--query [query]
- JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
- Output type.
json,text,csv
. Defaultjson
--verbose
- Runs command with verbose logging
--debug
- Runs command with debug logging
Remarks¶
You can update information of a user, either by specifying that user's id (objectId
) or user name (userPrincipalName
), but not both.
If the user with the specified id or user name doesn't exist, you will get 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 aad user set --objectId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --Department IT
Update multiple properties of user with name steve@contoso.onmicrosoft.com
m365 aad user set --userPrincipalName steve@contoso.onmicrosoft.com --Department "Sales & Marketing" --CompanyName Contoso
Enable user with id 1caf7dcd-7e83-4c3a-94f7-932a1299c844
m365 aad user set --objectId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --accountEnabled true
Disable user with id 1caf7dcd-7e83-4c3a-94f7-932a1299c844
m365 aad user set --objectId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --accountEnabled false
Enable user with id 1caf7dcd-7e83-4c3a-94f7-932a1299c844
m365 aad user set --objectId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --accountEnabled true