Azure Cosmos DB Mongo - Resource tokens - mongodb

I am investigating NoSQL Technologies for use in a project and Azure Cosmos Mongo API has arisen as an option. As part of Microsofts recommended architecture there is a Resource broker component middleware which retains ownership of the CosmosDB Master access key, and that can generate/distribute resource tokens for finer-grained access to consuming clients.
The documentation does not seem to allude to the Mongo API anywhere however and I cannot find information anywhere about it, is this pattern not available for the Cosmos Mongo API database? If that is the case, and Cosmos Mongo API requires access simply to a Master key, how would fine-grained access control and least privilege access be able to work?
There is an alternative question on Stackoverflow around creation of resource tokens but I would want to use an ORM such as mongoose in order to connect to CosmosDB with a resource token to avoid having to distribute Master keys out to many services.
Any answers greatly appreciated!

Resource Tokens are not possible with MongoDB API for Cosmos DB because MongoDB clients do not understand what to do with these. If you are looking at using Cosmos DB as a managed NoSQL database I recommend using the Core (SQL) API.
For more information on this see, Resource Tokens. There are also two reference implementations for token brokers, a Xamarin sample app and another built by Citrix.
Hope this is helpful.

Related

Migrate data from azure mongodb to azure search

I'm using Microsodt azure cloud provider in my project,where i have a mongodb installed on a VM on azure and also I have azure cognitive search instance . what I want to do is to migrate the data which i have on mongodb to azure search in order to create indexes and then use the restful apis on the client application.
my question is, is there a way to move data from mongodb to azure search please ?
Unfortunately there is not a built in Mongo DB connector for Azure Search as of now. However you have two options.
Migrate from Mongodb to Azure Cosmos DB (Mongo API) and then create an Azure Search Indexer for the Azure Cosmos DB in question, see https://learn.microsoft.com/en-us/azure/dms/tutorial-mongodb-cosmos-db-online
Write a custom code application that pulls data from Mongo and then send it to Azure Search indexes, you can do this by using the push API, take a look at https://learn.microsoft.com/en-us/azure/search/tutorial-optimize-indexing-push-api

Connecting springDataMongo app to Cosmos Db instead of MongoDb

I have an existing java springboot application that uses springDataMongo api to connect to an underlying Mongodb instance.
I need to use the existing springDataMongo api classes but instead of Mongodb, I need to connect Cosmos Db.
I have looked it up on documentation for azure Cosmos db api for Mongodb but didn't get hold of what I am trying to do.
Can someone let me know if what I am doing is possible and if yes, point me to a relevant documentation for the same.
Yes, it is possible to connect to Azure Cosmos DB MongoDB API using springDataMongo.
What you need to do is copy the Cosmos DB connection string from the Azure portal and then put it into spring.data.mongodb.uri in application.properties file of your spring boot project.
application.properties
#mongodb
spring.data.mongodb.uri=mongodb://[username]:[passowrd]#[cosmosdbName].documents.azure.com:10255/?ssl=true
spring.data.mongodb.database=[dababaseName]
After that done, you can check this guide out: Accessing Data with MongoDB.

Delete a row from mongodb database in azure

I am an azure newbie who has a mongodb database on Azure cloud storage. I am trying to delete a row with a specific value from the Query explorer in Azure, but I keep getting this error. Am I missing something?
delete from users where _id='...' doesnt work
neither does delete * from users where _id='' work
this works perfectly even if am doing SQL on a mongodb database while querying
I think you are using Microsoft DocumentDB (not mongoDB). DocumentDB is available on Azure and supports SQL-like queries.
I suggest taking a look at the documentation: https://azure.microsoft.com/en-us/documentation/articles/documentdb-sql-query/
According to the docs INSERT, UPDATE, and DELETE are only available through the REST API and not in the query language.

Connect to backend of VSO

Is there a way to get the server info of my VSO account and access using SQL Server?
I've tried logging in using the URL
{account}.visualstudio.com
But I got a sever not found error
No, the back-end databases are SQL Azure instances, different from the TFS on-premise databases. I cannot see MS ever giving you access to the database - maybe the data, but not the database.
You can only use the API (old and new REST) and Power BI tools to perform queries.
If you have a specific problem you are trying to solve, post it as a new question because it may be possible without database access.

Get metrics via API

I'm using Azure SQL, and there is a page in there with metrics
From what I understood the new Azure Managment Portal consumes only public apis. What I'm trying to find out is how to access these metrics via a REST or SOAP api. I've searched through the MSDN documentation but couldn't come up with anything.
Anyone have any ideas?
I presume Microsoft did not provide Azure Database monitoring REST or SOAP API as it would not be used much.
DBAs can connect to Azure Database and gather all the necessary statistics via dynamic management views which are quite powerful.
However, I do not have any article / documentation confirming my presumptions.
try the new sys.event_log and sys.database_connection_stats DMVs instead.
see: Announcing: New System Views for Windows Azure SQL Database