How to open authenticated connection to Cosmos DB emulator with Mongodb shell?

404 Views Asked by At

When I run

mongo --port 10255 --ssl

I get a connection to Cosmos db emulator in Mongodb mode. When I in that shell try to run

db.runCommand( { shardCollection: "myDB.myCollection", key: { myId: "hashed" } })

I get

{ "_t" : "OKMongoResponse",
"ok" : 0,
"code" : 13,
"errmsg" : "Not Authenticated",
"$err" : "Not Authenticated"
}

If I try to open the connection with the connectiong string I use in .net

mongo mongodb://localhost:C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==@localhost:10255/admin?ssl=true

I get

FailedToParse: Bad digit "C" while parsing C2y6yDjf5

How can I open up a shell to the cosmos db emulator to create a new collection as specified in this answer ComosDB - MongoAPI - Document does not contain shard key

0

There are 0 best solutions below