Share via

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.

0 comments No comments

Answer accepted by question author

KalyanChanumolu-MSFT 8,361 Reputation points
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.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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