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

Create Cosmos DB in Azure

 

Add the Subscription, Resource Group and Account Name and select Core (SQL) as API

Create Cosmos DB in Azure

 

Click review and create and this will create Cosmos DB in Azure

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

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments