Navigation

Alpha Release of MongoDB CLI

This is a pre-release early version of MongoDB CLI. Do not use MongoDB CLI to manage production environments.

mongocli ops-manager owner create

On this page

The owner create command creates the first user with the Global Owner role for an Ops Manager installation. You can also create the user through the Ops Manager API or the first time that you open the Ops Manager UI.

Syntax

mongocli ops-manager owner create
     --email <user-email-address>
     --firstName <user-first-name>
     --lastName <user-last-name>
     [ --password <user-password> ]
     [ --profile|-p <profile-name> ]
     [ --whitelistIps <user-connection-IP-addresses> ]

Note

Use -h or --help to view the command-line help for this command.

Options

Option Type Description Required?
--email string Email address of the user. yes
--firstName string First name of the user. yes
--lastName string Last name of the user. yes
--password string Password for the user. If omitted, prompts for password. no
--profile, -p string Name of the profile where the Ops Manager base URL is set. If omitted, uses the default profile. no
--whitelistIps string Comma-separated list of IP addresses to add to the API key. no

Output

The command prints the following fields in JSON format to the terminal if the command succeeds. If the command prints errors, see Troubleshooting for recommended solutions.

Field Type Description
apiKey string The personal API key for the user. Save the key in a secure file.
user object The user attributes that are set in Ops Manager. See User Attributes for more information.

User Attributes

Attribute Description
username Username of the user. This is same as the email address of the user.
firstName First name of the user.
lastName Last name of the user.
emailAddress Email address of the user.
id ID of the user.
links Array of objects with one or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.

Examples

The following examples show two ways to run the command. In Example 1, the command is run with all the required and optional options. In Example 2, the command is run without the --profile and --password options. The command uses the default profile for Ops Manager base URL and prompts for password.

Example 1

The following mongocli ops-manager owner create command creates the first user for Ops Manager with the following attributes:

  • First name: Jane
  • Last name: Doe
  • Password: p@s$w0rD
  • Email address: jane.doe@example.com
  • IP address for whitelist: 123.456.78.9

It uses the profile named omProfile for the Ops Manager base URL.

~ mongocli ops-manager owner create --firstName Jane --lastName Doe --password p@ssw0rD --email jane.doe@example.com --whitelistIps 123.456.78.9 --profile ``omProfile``

Example 2

The following mongocli ops-manager owner create commands show two ways to create the first user for Ops Manager with the following attributes:

  • First name: Jane
  • Last name: Doe
  • Email address: jane.doe@example.com
  • IP addresses to whitelist: 123.456.78.9 and 987.654.32.1

It uses the default profile where the Ops Manager base URL is set. When the command is run, it prompts you for a password.

The following command shows the --whitelistIps option with two IP addresses separated by a comma.

~ mongocli ops-manager owner create --firstName Jane --lastName Doe --email jane.doe@example.com --whitelistIps 123.456.78.9,987.654.32.1
Password: **********

The followibg command specifies the --whitelistIps option twice, once for each IP address.

~ mongocli ops-manager owner create --firstName Jane --lastName Doe --email jane.doe@example.com --whitelistIps 123.456.78.9 --whitelistIps 987.654.32.1
Password: **********

Output

The Example 1 and Example 2 commands print the following fileds in JSON format to the terminal. To learn more about these fields, see Output.

{
       "apiKey": "34a93114-ec2b-4125-992e-1dd87c4148e4",
       "user": {
             "username": "jane.doe@example.com",
             "firstName": "Jane",
             "lastName": "Doe",
             "emailAddress": "jane.doe@example.com",
             "id": "5e39bd5c31cd7c0078867c03",
             "links": [
                     {
                             "rel": "self",
                             "href": "http://om-svc.mongodb.svc.cluster.local:8080/api/public/v1.0/users/5e39bd5c31cd7c0078867c03"
                     },
                     {
                             "rel": "http://mms.mongodb.com/whitelist",
                             "href": "http://om-svc.mongodb.svc.cluster.local:8080/api/public/v1.0/users/5e39bd5c31cd7c0078867c03/whitelist"
                     }
             ]
       }
}