title: Cosmos DB Error: com.mongodb.MongoCommandException: Command failed with error 11: 'Database account is not found'
body: <p>I have created a Cosmos DB(with Mongo API) in my azure subscription.</p>
  
  <p>now trying to connect to CosmosDB using my existing code to connect to mongo DB. i just change the code to create mongo client.</p>
  
  <p>i created the Mongo Client using connectionstring i got from Cosmos DB -> connection strings.</p>
  
  <p>the same thing works with the Cosmos DB provided by microsoft for trial. 
  it can be created from <a href="https://azure.microsoft.com/en-us/try/cosmosdb" rel="nofollow noreferrer">https://azure.microsoft.com/en-us/try/cosmosdb</a>.</p>
  
  <p>but it does not work with the Cosmos DB i created in my subscription.</p>
  
  <p>i get below errors:</p>
  
  <pre><code>com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='[myusername]', source='admin', password=&lt;hidden&gt;, mechanismProperties={}}
  at com.mongodb.connection.SaslAuthenticator.wrapInMongoSecurityException(SaslAuthenticator.java:157) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:37) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:66) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:44) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:162) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:44) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.DefaultAuthenticator.authenticate(DefaultAuthenticator.java:32) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:109) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:46) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:116) ~[mongo-java-driver-3.4.2.jar:?]
  at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) [mongo-java-driver-3.4.2.jar:?]
  at java.lang.Thread.run(Unknown Source) [?:1.8.0_171]
  
  
  Caused by: com.mongodb.MongoCommandException: Command failed with error 11: 'Database account is not found' on server [my cosmosdb name].documents.azure.com:10255. The full response is { "_t" : "OKMongoResponse", "ok" : 0, "code" : 11, "errmsg" : "Database account is not found", "$err" : "Database account is not found" }
      at com.mongodb.connection.CommandHelper.createCommandFailureException(CommandHelper.java:170) ~[mongo-java-driver-3.4.2.jar:?]
      at com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:123) ~[mongo-java-driver-3.4.2.jar:?]
      at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32) ~[mongo-java-driver-3.4.2.jar:?]
      at com.mongodb.connection.SaslAuthenticator.sendSaslContinue(SaslAuthenticator.java:121) ~[mongo-java-driver-3.4.2.jar:?]
      at com.mongodb.connection.SaslAuthenticator.access$100(SaslAuthenticator.java:37) ~[mongo-java-driver-3.4.2.jar:?]
      at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:63) ~[mongo-java-driver-3.4.2.jar:?]
      ... 9 more
  </code></pre>
  
  <p><strong>am i missing any configurations on my azure portal???</strong></p>