Create Cosmos Database in Azure
This tutorial talks about how to create cosmos database in microsoft azure cloud platform.
Azure Cosmos DB is Microsoft’s globally distributed, multi-model database service. To learn more about cosmos db then please see – https://docs.microsoft.com/en-us/azure/cosmos-db/introduction
Let’s create Cosmos DB in Azure
Azure portal -> Cosmos DB -> Add
Add the Subscription, Resource Group and Account Name and select Core (SQL) as API
Click review and create and this will create Cosmos DB in Azure
Click on DB account and the select Container -> Browse
Click on Add Collection
Collection details
- Database id – is like schema in relational DB
- Container id – is like table in relational DB
- Partition key – is the key on the basis of which you can group the different entry e.g. department
- Unique keys – to add data integrity, making sure these keys have unique values
Click ok and this will create the Cosmos DB container in Azure
Go to Cosmos DB and click Keys
Please note down the URI and key as this will help us in authenticating the MuleSoft API call to Azure
URI: https://mulesydb.documents.azure.com:443/
PRIMARY KEY: 0SZd1Zs3hySH915hKBTQCbewWnzIEI4S2YK8yHDaRwMrnzrZSwaa0hHy8IW21x4qbsQoswWIh3FW8TOd0fpSYw==
Different SQL REST APIs available for different calls, please check yours as per your need.
- Cosmos DB – https://docs.microsoft.com/en-us/rest/api/cosmos-db
- Create collection – https://docs.microsoft.com/en-us/rest/api/cosmos-db/create-a-collection
- Create Document in Collection – https://docs.microsoft.com/en-us/rest/api/cosmos-db/documents
POSTMAN APIs for same – https://github.com/MicrosoftCSA/documentdb-postman-collection