Kick Start with Azure Cosmos DB - Part 2

by Santhakumar Munuswamy

  Posted on  07 March 2018

  Azure Cosmos DB


 

In this article, we will learn how to create a new Azure Cosmos DB for free. How? Can we use it for free?  I have found a couple of alternative ways to use the Azure Cosmos DB for free without an Azure Subscription. Good thing, no credit card details are required. I hope you have read my previous article. If not yet, then you can go and read my previous article here. The first way is, you can create a new Azure Cosmos DB for free of cost without credit card number. The second way is, you can use the Azure Cosmos DB Emulator for the development purpose in your laptop. 

In this article, we will see the following,

  • How to create a new Azure Cosmos DB for free 
  • How to install the Azure Cosmos DB Emulator
  • How to start the Azure Cosmos DB Emulator
  • How to create a new database and collection using Azure Cosmos DB Emulator
  • How to connect the Azure Cosmos DB Emulator locally in .Net Apps

Prerequisite

  • Azure Cosmos DB for free 
  • Azure Cosmos DB Emulator 
How to create a new Azure Cosmos DB for free

You can learn in this section, how to create a new Azure Cosmos DB account creation using the Azure portal at the following guidelines.

Go to open the new browser, you can copy and paste the following URL 
https://azure.microsoft.com/en-us/try/cosmosdb/


Then, Choose the database service and click the Create button



Now, you have to authenticate using Microsoft account credential the following screenshot


After successfully authenticated to the Microsoft account. You can see the following screen will appear and click the Open in the Azure portal button as below screenshot



After successfully Azure Cosmos DB account is created, the Congratulations! Your Azure Cosmos DB account was created window will be opened in the following screenshot



Note: you can see highlighted account expiry information for the above screen. The free account will expire on 06d:22h:00min. if you want more for free? You have to sign up for Azure Free Trial or extend the current account.

How to install the Azure Cosmos DB Emulator

You can learn in this section, how to install the Azure Cosmos DB Emulator in the local environment and system requirements at the following guidelines.

The following software and hardware requirement are

  • Windows Server 2016, Windows Server 2012 R2, Windows 10
  • 2 GB Ram
  • 10 GB free space for HDD
Now, you can download the Azure Cosmos DB Emulator from the following URL

https://aka.ms/cosmosdb-emulator


Double click the Azure Cosmos DB.Emulator.msi file 


The Azure Cosmos DB Emulator setup window will be opened


The Azure Cosmos DB Emulator License Agreement window will have opened, you can check the terms of license agreement and click the Install button


You can see the installation process started now


After successfully installed Azure Cosmos DB Emulator, click the Finish button 


Now you can get the notification for starting Azure Cosmos DB Emulator service in taskbar area. Also, you can find the icon in the windows notification tray as below screens



After successfully Azure Cosmos DB account is started, the Congratulations! Your Azure Cosmos DB emulator is running window will be opened in the following screenshot

https://localhost:8081/_explorer/index.html


How to start the Azure Cosmos DB Emulator

You can learn in this section, how to star the Azure Cosmos DB Emulator on your laptop at the following guidelines.

You can go to Start button à Type Azure Cosmos DB Emulator in the Search Box, then you can see the Azure Cosmos DB Emulator desktop app. Click the Azure Cosmos DB Emulator



Now you can get the notification for starting Azure Cosmos DB Emulator service in taskbar area. Also, you can find the icon in the windows notification tray as below screens


After successfully Azure Cosmos DB account is started, the Congratulations! Your Azure Cosmos DB emulator is running window will be opened in the following screenshot

https://localhost:8081/_explorer/index.html


How to create a new database and collection using Azure Cosmos DB Emulator

You can learn in this section, how to create a new database and collection in Explorer using Azure Cosmos DB Emulator at the following guidelines.

You can go to Explorer à click the New Collections


The Add Collection window will open and you can enter the following details are required for the screenshots. Then, click the OK button.

  • Database Id
  • Collection Id
  • Storage Capacity 
  • Throughput


You can see the new database and collection looks at the following screenshot



How to add data to the collection using Explorer

You can learn in this section, how to add sample data to the collection in Explorer using Azure Cosmos DB Emulator in the local environment at the following guidelines.

You can go to Explorer à Expand the TableBooking collection in the Collection window, click the Documents à click the New Document. 



The new document window will open and add the data to the collection with the following format.


Once you have added JSON data to the document and click the Save button.


After successfully added records to the collection it looks like the following screenshot



Reference

  • https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator

Conclusion

I hope you understand now about Azure Cosmos DB, How to create a new Azure Cosmos DB for free, How to install the Azure Cosmos DB Emulator, How to start the Azure Cosmos DB Emulator, How to create a new database and collection using Azure Cosmos DB Emulator. I have covered all the required things. If you find anything missing, please let me know.
Please share your valuable comments or feedback to improve my future articles.
 


About the Author
He is a Technical Lead, C# Corner MVP, Author and founder of the blog www.san2debug.net, has over 9+ years experience on Microsoft Technologies like C#.Net, ASP.Net, ADO.Net, MVC, WCF, Ajax, IIS, SQL Server, Windows Phone and some developmet tools. He is an actively spending his valuable time to popular .Net Community like C# Corner, Microsoft TechNet Wiki, DZone, Stackoverflow, DotNetSpark and etc.

Follow Me: Facebook, Twitter, Google Plus, LinkedIn
blog comments powered by Disqus


Month List

Community Badges