Mongodb source error "Could not find/access authentication database $external."

How to configure mongodb source to connect AD authentication.

Dremio Version: 13.1.0-202102110202430875-3e6f3e7c
MongoDB server version: 3.6.11
Authentication Configured: Active Directory

Following connection working:
mongo --authenticationDatabase ‘$external’ --host server1.FQDN,server2.FQDN --port 27017 -ssl true --username UserName --password --authenticationMechanism PLAIN

Trying to configure Mongodb source, my mongodb configured to connect AD for authentication.

Authentication Database: $external
Getting error “Could not find/access authentication database $external.Show more”

Advanced Options configured: sslInvalidHostNamesAllowed = true

Logs: Redacted username.

ERROR c.d.p.mongo.MongoDocumentHelper - Mongo command returned with invalid return code (not OK), Could not authenticate user UserName for database admin : {“Exception”: “com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName=‘UserName’, source=‘admin’, password=, mechanismProperties=}”}
2021-03-18 19:00:02,957 [qtp1423523790-182885] INFO c.d.p.m.connection.MongoConnection - User Error Occurred [ErrorId: e6d89475-4084-4840-b231-24e7b298fc5d]
com.dremio.common.exceptions.UserException: Could not find/access authentication database admin.


It seems like the username given in the Mongo source is producing a Mongo error “Could not find/access authentication database admin.”, have you checked with your Mongo DBA if the user can be granted this role/privilege


Following connection string is working on CLI, as well as python and Java applications.

mongo --authenticationDatabase ‘$external’ --host server1.FQDN,server2.FQDN --port 27017 -ssl true --username UserName --password --authenticationMechanism PLAIN

how to configure following properties for mongodb db connection.

  1. sslInvalidHostNamesAllowed=false, configure as true. To allow SSL clients which are not part of SSL Subject Alternate Name.

  2. Our mongodb configured to authenticate with enterprise Active Directory user/password, no local admin db configured for mongodb schema access.

Thank you for review and guidance.


#1 You can try passing via the Hive source advanced options
#2 Currently Dremio only supports MongoDB username