Where is the primary key in the Cosmos DB GUI? - azure-cosmosdb

I'm new to Azure CosmosDB NoSQL. I have created a new account and a new Cosmos DB. I'm following this tutorial. I can't seem to find the config.key as it is in the image:
I guess it is not an up to date tutorial. What I have:
I have found the URI (which is not in the keys section), but where is the primary key?

As you have pointed out, you use Azure CosmosDB NoSQL while the first picture is Core (SQL) type of account.
And the second picture you provided is using Azure Cosmos Db for Mongo DB API in API attribute. So, to connect Mongo DB, you just need to use Primary Connection String.

Related

Manage Partition Key in Azure Cosmos DB with C# SDK

Is there any way to manage an Azure Cosmos DB collection with partition key that uses the Mongo API directly from c#?
Currently we use Terraform to provision the Cosmos DB account and the database and we use the MongoDB.Driver to administrate collections. To get the Collection (and create it if it does not exist), we use the following syntax:
public IMongoCollection<MyDocument> MyDocumentsCollection =>
Database.GetCollection<MyDocument>("MyDocuments", mongoCollectionSetting);
I do not see any option to set the partition key for the collection and I was expecting to accomplish this with the mongoCollectionSettings. What is the best option to get this working?
I have found the Microsoft.Azure.Cosmos SDK but this is only applicable for Cosmos DB's SQL API.
Also I don't want to start with the method RunCommand but I guess this is the only option...?! Is it?

I have a requirement to load data from azure cosmos db (json format) into snowflake. what are my options?

I tried using nodeJS function to trigger on cosmos change feed and insert into snowflake table columns directly but that seems to be slow. please suggest any other options
You can use ADF that has both snowflake and Azure Cosmos db Connector. Azure Cosmos db will be your source and Snowflake can be used as sink.
Create a linked service to Azure Cosmos DB using UI
Snowflake as sink
Good part is Azure Cosmos db Change feed is now supported in ADF, so this can also be integrated through ADF.
Native change data capture (CDC) - CosmosDB change feed is supported in ADF now

How do I change API in cosmosDB?

I have a cosmosDB with mongo API, however there are many features not supported in this API so I want to switch to SQL API?
As things stand today it is not possible to switch you account from one type to another.
This is what you need to do if you need to switch to the SQL API:
Create a SQL API Cosmos DB Account
Download the Cosmos DBmigration tool
Migrate all the data from the MongoDB account to the SQL API account
Delete the MongoDB account

CosmosDB Error while fetching page of documents: {"code":400,"body":"Command find failed: Unknown server error occurred when processing

I'm new to CosmosDB and have used Data Factory to import some test data from a BLOB into a CosmoDB container. The Monitor screen tells me it was successful. I then went to the Azure portal, opened my container and clicked 'Documents' but this does not show me any data. I then clicked the refresh button in the sub-pane (the one on the 'load more' section) and it gave me the error:
Error while fetching page of documents:
{"code":400,"body":"Command find failed: Unknown server error occurred when processing this request.."}
I also could not find any good tutorials online or on Youtube that shoes step by step how to import a CSV from BLOB storage into ComosDB Document store via DataFactory, so unable to tell if I am doing it correctly.
I contacted Microsoft. Response was: "The Azure Data Factory loads data using the SQL API SDK, and does not support mMngo yet. The data loaded using the SQL API SDK would have to be in MongoDB BSON schema. Also, the Mongo DB Native driver expect the data in JSON schema and fails to deserialize triggerin the 400 error."
The MongoBulkExecutor API was recommended as an alternative but from what I can tell this really requires json too.
I also could not find any good tutorials online or on Youtube that
shoes step by step how to import a CSV from BLOB storage into ComosDB
Document store via DataFactory, so unable to tell if I am doing it
correctly.
In fact, you should check the below components when you import csv from blob storage into cosmos db.
1.You already have created cosmos db Linked Service and DataSet.
2.You already have created cosmos db Linked Service and DataSet.
You could do the above steps on the portal.
3.Create copy activity and fill the blob storage input and cosmos db output into the activity.
4.In addition,you need to know cosmos db sql api and cosmos db mongo api are different api,though they call named cosmos db. Based on Supported capabilities in document: Copy data to or from Azure Cosmos DB by using Azure Data Factory, Azure Cosmos DB connector only supports Copying data from and to the Azure Cosmos DB SQL API. So,please don't confuse.
If you do want to use Mongo api, you could choose mongo connector to do your jobs which is mentioned in this case:https://social.msdn.microsoft.com/Forums/security/en-US/52cddbf7-c132-490c-9088-65a38f9b7200/copy-activity-to-cosmosdb-with-mongo-api?forum=AzureDataFactory.

Restrict user access to Azure CosmosDB MongoDB Database

Azure CosmosDB - MongoDB provides keys for Read-Write and Read Only at account level.
CosmosDB SDK and API are there through which users can be created and access can be define at database and document level.
• But What I need to do is to create a pair of username and password with restricted access to a MongoDB database similar to one provided by installable MongoDB.
• How a user can connect only CosmosDB MongoDB database using RoboMongo.
Highly appreciate any help.
Amit -
Today, Cosmos DB access are provided by using two keys, Master Key and Read Only key. However, if you want to restrict user access per collection, per document etc, you have to use Resource Tokens. You can read more about it here and please take a look at CH9 video to see the implementation details. Resource Token service can be implemented as an Azure Function. Here is code to get you started.
But if you are using RoboMongo you have to Use the keys as define in this document. At this time you cannot define different users and Keys for a Database.

Resources