mongocli iam user invite
On this page
The mongocli iam user invite
command invites
the specified users to join the specified organization or project.
You can also invite users to:
Atlas using the UI for your organization or project and using the API.
Cloud Manager using the UI for your organization or project and using the API.
Ops Manager using the UI for your organization or project and using the API.
The user must accept your invitation to join the project or organization.
Permissions Required
The following tables shows the roles you must have to invite users to your MongoDB service organization or project:
MongoDB Service | Organization | Project |
---|---|---|
Atlas | Organization Owner
role | Project Owner role |
Cloud Manager | Organization Owner role |
|
Ops Manager | Organization Owner
role |
|
Syntax
mongocli iam user invite --country <country-code-of-user> --email <email-address-of-user> --firstName <first-name-of-user> --lastName <last-name-of-user> [ --mobile <mobile-number-of-user> ] [ --orgRole <org-role-of-user> ] [ --output|-o <output-format> ] --password <password-of-user> [ --profile|-P <profile-name> ] [ projectRole <project-role-of-user> ] --username <username-of-user>
Note
Use -h
or --help
to view the command-line help for
this command.
Options
Option | Type | Description | Required? |
---|---|---|---|
--country | string | Primary country where the user is based. Must match a
two-letter ISO 3661-1
country code. |
|
--email | string | Email address of the user. | yes |
--firstName | string | First name of the user. | yes |
--lastName | string | Last name of the user. | yes |
--mobile | string | Mobile telephone number of the user. | no |
--orgRole | string | Name of the organization role to assign to the user. For the list of valid organization roles for your MongoDB service, see: If omitted, user is granted the following role for your MongoDB service:
| no |
--output , -o | string | Command output format. Valid values are:
If omitted, the command returns output in the default format. | no |
--password | string | Password of the user. | yes |
--profile , -P | string | Name of the profile that contains the access information. If
omitted, uses the default profile. | no |
--projectRole | string | Name of the project role to assign to the user. For the list of valid project roles for your MongoDB service, see: If omitted, user is granted the following role for your MongoDB service:
| no |
--username | string | Username of the user. Value must be a valid email address. | yes |
Output
The command prints the following to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.
The user '<username>' has been invited. Invited users do not have access to the project until they accept the invitation.
The above default output is a subset of the fields returned by this command. For the complete list of JSON fields returned by the command, see the API reference for your MongoDB service:
Example
The following command invites a new user to an Ops Manager organization. It uses the default profile for accessing Ops Manager.
mongocli iam users invite --username john.doe@example.com --password changeMe --email john.doe@example.com --firstName john --lastName doe
The previous command prints the following in the default format to the terminal.
The user 'john.doe@example.com' has been invited. Invited users do not have access to the project until they accept the invitation.
The following command invites a new user to an Atlas organization. It uses the default profile for accessing Atlas.
mongocli iam users invite --username john.doe@example.com --password changeMe --email john.doe@example.com --firstName john --lastName doe --country US -o json
The previous command prints the following in the default format to the terminal.
{ "emailAddress": "john.doe@example.com", "firstName": "john", "id": "5f71e5255afec75a3d0f96dc", "lastName": "doe", "roles": [], "username": "john.doe@example.com", "mobileNumber": "", "password": "", "country": "US" }