Not getting access with newly created user in cosmosdb for mongodb

Sanjay Mange 5 Reputation points
2024-05-14T11:18:05.34+00:00

I have created user in consmosdb for mongodb api with built-in role but while accessing with newly created user getting Error: invalid salt length provided

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

3 answers

Sort by: Most helpful
  1. ShaktiSingh-MSFT 14,281 Reputation points Microsoft Employee
    2024-05-15T03:55:53.0266667+00:00

    Hi Sanjay Mange •,

    Welcome to Microsoft Q&A forum.

    As I understand, you are not getting access to Azure Cosmos DB with a newly created user.

    Could you please let us know how new created was created? via Portal/CLI/Powershell/Code, Network configuration of your Cosmos Account?

    You may refer here: https://stackoverflow.com/questions/77125681/php-laravel-mongodb-scram-failure-invalid-salt-length-of-16-in-sasl-step2

    I would recommend you to please file a support ticket for deeper investigation and in case if you don't have a support plan, do let us know here so that we can check on other options to unblock you.

    Thanks

    0 comments No comments

  2. elisa555 0 Reputation points
    2024-07-05T16:00:18.5533333+00:00
    1. Check Password Complexity: Ensure the password meets the complexity requirements of Cosmos DB. It should have a mix of uppercase, lowercase, numbers, and special characters.
    2. Update User Password: Try updating the password for the user to ensure it is properly hashed and meets the required complexity.
         bashCopy code
         db.updateUser(
         
      
    3. Verify Connection String: Make sure your connection string is correctly formatted and includes the username and password.
         bashCopy code
         mongodb://username:newComplexPassword@your-cosmosdb-uri:port/dbname?ssl=
      
    4. Review Roles and Permissions: Ensure that the user has the appropriate roles and permissions assigned.
    0 comments No comments

  3. ShaktiSingh-MSFT 14,281 Reputation points Microsoft Employee
    2024-07-08T03:50:01.68+00:00

    Hi Sanjay Mange •,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue:

    Solution:

    In CX Verbatim:

    "This is resolved by using this connection string: "mongodb://<user_name>:<password>@<host_name>:<port>/<db_name>?ssl=true&retrywrites=false&replicaSet=globaldb&authmechanism=SCRAM-SHA-256&appname=@<app_name>@","

    If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    Thanks

    0 comments No comments