Navigation

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>
     [ --output|-o <output-format> ]
     [ --password|-p <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
--output, -o string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using Go template file

If omitted, the command returns output in the default format.

no
--password, -p 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 the specified 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.
programmaticApiKey object

An object describing the programmatic API key for the user. For a detailed description of the object, see Programmatic API Key Attributes.

Note

The response contains a programmaticApiKey object only for Ops Manager 4.4 and later.

user object The user attributes that are set in Ops Manager. For a detailed description of the object, see User Attributes.

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.

Programmatic API Key Attributes

Name Type Description
desc string Description of the programmatic API key.
id string Unique identifier of the programmatic API key.
links array of objects 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.
privateKey string A series of alphanumeric characters and dashes that serve as the password of the programmatic API key.
publicKey string A series of alphanumeric characters that serve as the username of the programmatic API key.
roles
array of objects Roles assigned to the programmatic API key.
roles
.roleName
string Name of the assigned role. Ops Manager grants the programmatic API key the Global Owner role (GLOBAL_OWNER).

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: ChangeThisToAStrongPassword
  • 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 CHangeThisToAStrongPassword --email jane.doe@example.com --whitelistIps 123.456.78.9 --output json --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 198.51.100.0

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 --output json --whitelistIps 123.456.78.9,198.51.100.0
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 --output json --whitelistIps 198.51.100.0
Password: **********

Output

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

{
     "apiKey": "34a93174-ec7b-4725-972e-1dd77c4178e4",
     "programmaticApiKey": {
             "desc": "Automatically generated Global API key",
             "id": "{API-KEY}",
             "links": [{
                     "href": "http://om-svc.mongodb.svc.cluster.local:8080/api/public/v1.0/orgs/null/apiKeys/{API-KEY}",
                     "rel": "self"
             }],
             "privateKey": "private key string",
             "publicKey": "public key string",
             "roles": [{
                     "roleName": "GLOBAL_OWNER"
             }]
     },
     "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"
                     }
             ]
     }
}