The External Secrets Enterprise product suite is a premium product.
It requires a specific subscription. Contact us for more information.
It requires a specific subscription. Contact us for more information.
In order to use the MongoDB User Generator, you must have the Enterprise Distribution of ESO available via ESI Agent or via our Helm chart bundle
Introduction
Managing MongoDB users manually can be error-prone and operationally expensive, especially when dealing with scoped permissions and dynamic workloads.The MongoDB User Generator automates the creation, rotation, and deletion of MongoDB user accounts with custom roles and minimal overhead. This generator is especially useful for providing temporary access to applications, improving security posture through least-privilege principles, and removing the need for manual user provisioning.
Output Keys and Values
Key | Description |
---|---|
user | The generated MongoDB username |
password | The generated MongoDB password |
Parameters
Key | Default | Description |
---|---|---|
database.adminDB | "admin" | Name of the MongoDB administrative database used to authenticate. |
database.host | Required | Hostname or IP of the MongoDB instance. |
database.port | 27017 | Port used to connect to the MongoDB instance. |
auth.scram.username | Optional | Username used for SCRAM authentication. |
auth.scram.secretRef.usernameSecretRef | Optional | Secret reference for the SCRAM username. |
auth.scram.secretRef.passwordSecretRef | Required | Secret reference for the SCRAM password. |
user.name | Optional | Desired username for the MongoDB user. If not specified, one is generated. |
user.roles | Required | List of roles to assign to the user. Each role must include a name and db . |
Set up
MongoDB Permissions
The SCRAM user used for authentication must have permission to create and manage other users and roles in the target database(s). This typically means having theuserAdmin
or userAdminAnyDatabase
role in the admin database.
Generator Config
ExternalSecret Config
Using the Generated Secret
Notes and Considerations
- This generator currently supports only SCRAM authentication with secret-based credential references.
- If no
user.name
is provided, a username is automatically generated and will follow ESO’s default randomization strategy. - Roles must exist in the specified database; otherwise, MongoDB will return an error.