Navigation

mongocli iam globalApiKey update

The iam globalApiKey update command updates the roles and the description of the specified Global API Key. You can also modify the Global API Key roles and description using the Ops Manager UI and API. You must have the Global Owner role to update a Global API key.

mongocli iam globalApiKey|globalApiKeys update <api-key-id>
--desc "<description-of-key>"
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
--role <list-of-roles>
Note

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

Argument
Type
Description
Required?
<api-key-id>
string
Unique identifier of the Global API Key to update.
yes
Option
Type
Description
Required?
--desc
string
Description of the Global API Key to update. This description can’t be longer than 250 characters.
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 the Go template file

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

no
--profile, -P
string

Name of the profile where your credentials are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.

You must have credentials with the Global Owner role to update a Global API Key.

no
--role
string

Role or roles to assign to the API key. To assign more than one role, you can specify each role with a --role flag or specify the roles in a comma-separated list with one --role flag. Global roles accepted by default include:

Role Value in API
Role
GLOBAL_AUTOMATION_ADMIN
GLOBAL_BACKUP_ADMIN
GLOBAL_MONITORING_ADMIN
GLOBAL_OWNER
GLOBAL_READ_ONLY
GLOBAL_USER_ADMIN
yes

If the command succeeds, it returns the following output in the default format. If the command returns errors, see Troubleshooting for recommended solutions.

API Key '<api-key-id>' successfully updated.

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

The following command updates the description and role of a Global API Key using the default profile, which contains credentials for accessing the Ops Manager instance. The output is returned in the default format.

mongocli iam globalApiKey update 5f3d8790c9022019903c1234 --role GLOBAL_MONITORING_ADMIN --desc "My Sample Global API Key"

The previous command prints the following to the terminal.

API Key '5f3d8790c9022019903c1234' successfully updated.
Give Feedback