Cosmos DB + Mongo using resource token

Ievgen Burdin 21 Reputation points
2020-06-10T08:09:23.473+00:00

Hello! I develop a python application that must use cosmos resource tokens to authorize clients for resources. I have a few questions, please give me some advice.

I did not find any documentation on how to authenticate MongoDB using resource token, does this possible?

I tried to interact with mongo on cosmos db using CosmosClient (azure-cosmos==4.0.0) and using REST API and got error {"code":"Forbidden","message":"Sql api is not supported for this database account\r\nActivityId: ..., Microsoft.Azure.Documents.Common/2.11.0”} in both cases. Does mongo in cosmos support REST API?

https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb-introduction#cosmos-dbs-api-for-mongodb
This doc saying that by default possible to interact using SQL API, I got that error.

Please give me some advice.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,050 questions
0 comments No comments
{count} votes

Accepted answer
  1. KalyanChanumolu-MSFT 8,256 Reputation points Microsoft Employee
    2020-06-10T09:12:36.523+00:00

    You will not be able to use Resource Tokens with MongoDB API for Cosmos DB.
    This is not a limitation in Azure Cosmos DB but with the MongoDB clients itself

    If you are looking at using Cosmos DB as a managed NoSQL database we recommend using the Core (SQL) API.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful