Mongodb – How to add userAdmin user in Mongodb Atlas

mongodbmongodb-atlas

How to add a user with userAdmin role in Atlas?

The Cluster Security "Add New User" UI https://cloud.mongodb.com/v2/…..#clusters/security/users shows only limited set of built-in roles without any option to enter role name manually:

enter image description here

So I am a bit stuck here – there are no options in the UI, and non of the existing roles allow to add users in a shell.

UPDATE:

To make it crystal clear I went To "Security" tab in MongoDB Atlas cluster, from there I clicked "Add a new User", clicked "Show advanced options" and got the screenshot above.

UPDATE 2:

None of the roles in the list have userAdmin privilege.

The most "powerful" atlasAdmin covers only:

  • readWriteAnyDatabase
  • readAnyDatabase
  • enableSharding
  • dbAdminAnyDatabase
  • clusterMonitor

and doesn't have enough privilege to execute db.createUser() command.

Best Answer

You cannot grant this role. The only way to create new MongoDB users in Atlas is either via the UI or the API. See Add MongoDB Users for details and note that this page states:

Atlas rolls back any user modifications not made through the UI or API. You must use the Atlas UI or API to add, modify, or delete MongoDB users on Atlas clusters.

See Create a Database User for details on how to create MongoDB users via the API.