Having issue running mongodump

26285235 0 Reputation points
2025-05-27T18:22:40.5333333+00:00

Hello i need to run backup dump on mongodb azure instance
instance name - mongodb.dev.as-cluster.co
error-
massefa@MH4L2JK41X bin $ mongodump --uri="mongodb+srv://allseated:******@mongodb.dev.as-cluster.co/?tls=false" --db=test --out /Users/massefa/Desktop/mongodump/2025-05-27T13:35:56.128-0400

2025-05-27T14:02:12.030-0400 Failed: can't create session: failed to connect to mongodb+srv://allseated:******@mongodb.dev.as-cluster.co/?tls=false: connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.
massefa@MH4L2JK41X bin $ ls -al

total 251416

drwxr-xr-x@ 10 massefa  staff       320 May 22 16:29 .

drwxr-xr-x@  8 massefa  staff       256 May 27 11:47 ..

-rwxr-xr-x@  1 massefa  staff  10814480 May 22 16:29 bsondump

-rwxr-xr-x@  1 massefa  staff  17075872 May 22 16:29 mongodump

-rwxr-xr-x@  1 massefa  staff  16790816 May 22 16:29 mongoexport

-rwxr-xr-x@  1 massefa  staff  16774352 May 22 16:29 mongofiles

-rwxr-xr-x@  1 massefa  staff  16972368 May 22 16:29 mongoimport

-rwxr-xr-x@  1 massefa  staff  17439376 May 22 16:29 mongorestore

-rwxr-xr-x@  1 massefa  staff  16601984 May 22 16:29 mongostat

-rwxr-xr-x@  1 massefa  staff  16239792 May 22 16:29 mongotop
I can successfully connect to the mongo uri
mongosh "mongodb+srv://mongodb.dev.as-cluster.co/?tls=false" --username allseated  

Enter password: ****************

Current Mongosh Log ID: 6835cb5dd8d53085f32bd59c

Connecting to: mongodb+srv://

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Prasad Chaganti 770 Reputation points Microsoft External Staff Moderator
    2025-05-27T22:46:42.1733333+00:00

    Hi 26285235,

    1.Confirm the Authentication Mechanism

    • Your URI uses SCRAM-SHA-1 by default. However, some MongoDB Atlas clusters (or Azure-hosted MongoDB instances) may require SCRAM-SHA-256.

    Try explicitly specifying the mechanism:

    mongodump --uri="mongodb+srv://allseated:******@mongodb.dev.as-cluster.co/?authMechanism=SCRAM-SHA-256&tls=false" --db=test --out /Users/massefa/Desktop/mongodump/2025-05-27T13:35:56.128-0400
    

    2.Double-Check the Password

    Even though mongosh works, ensure:

    • The password is not URL-encoded in the URI.
    • If it contains special characters (like @, :, /, etc.), they must be percent-encoded in the URI.

    For example, if your password is DGWFHy9IzNECPpv4!, encode it as:

    DGWFHy9IzNECPpv4%21

    3.Try Using --username and --password Separately

    Instead of embedding credentials in the URI, try:

    mongodump --host="mongodb.dev.as-cluster.co" --username="allseated" --password="DGWFHy9IzNECPpv4" --authenticationDatabase="admin" --db=test --out /Users/massefa/Desktop/mongodump/2025-05-27T13:35:56.128-0400
    

    4.Check IP Whitelisting and Network Access

    • Ensure your current IP is allowed in the MongoDB instance’s network access settings (especially if hosted on Azure Cosmos DB or MongoDB Atlas).

    5.Validate TLS Settings

    • If your cluster enforces TLS, setting tls=false might be causing the issue. Try removing it or setting tls=true.

    Kindly request you to please review the answer and do let us know if you have any further concerns. we are happy to help you.

    If all your queries are addressed, please do accept the answer.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.