Azure Cosmos DB is a multi-API, multi-model highly scalable NoSQL database services from Microsoft Azure platform. In order to develop an application consuming Azure Cosmos DB requires an azure live subscription or emulator in your local machine.
The Azure Cosmos DB Emulator provides a local development/test environment for Azure Cosmos DB development purposes. Using Azure Cosmos DB Emulator, you can develop and test your application locally, without needing an azure subscription or without subscription costs.
With this article I am going to take you through necessary steps and requirements to set up your local environment.
Azure Cosmos DB emulator has the following software and hardware requirements:
- Software requirements
- Windows Server 2012 R2, Windows Server 2016, or Windows 10
- Minimum Hardware requirements
- 2 GB RAM
- 10 GB available hard disk space
- Download Azure Cosmos DB Emulator (DocumentDb.Install.msi) ** do not get confused by the name. Azure Cosmos DB is a super set of Document DB, and the DocumentDb emulator they tweaked a bit to support Cosmos Db.
- Install DocumentDb.Install.msi
Additionally Azure CosmosDB emulator can be run on Docker for Windows. After installing Docker for Windows, you can pull the Emulator image from Docker Hub.
docker pull microsoft/azure-documentdb-emulator
3. Start/Launch Azure Cosmos DB Emulator:
After some time you can see the emulator started. When the Azure Cosmos DB emulator launches it will automatically open the Azure Cosmos DB Data Explorer in your browser.
The address will appear as https://localhost:8081/_explorer/index.html
Incase you have closed browser and later would like to open the explorer again, you can open the Data Explorer by right clicking on the taskbar menu.
Now you can write some sample app to try it, or download already created sample applications from Microsoft depending on the preferred platform of your choice.
4. Limitation of Azure Cosmos DB Emulator: (or Differences between Azure Cosmos DB Emulator vs Real Cosmos DB Cloud Service)
Since the Azure Cosmos DB Emulator provides an emulated environment running on a local developer workstation, there are some fundamental differences between the emulator and an Azure Cosmos DB account in the cloud:
The following table is also helpful in determining when to use Cosmos DB Emulator and when direct cloud service. Depending on the choice of requirement, you would need to use associated services efficiently.
|Cosmos DB Emulator||Cosmos DB Cloud Service|
|Supports only a single fixed account and a well-known master key. Key regeneration is not possible.||Supports multiple accounts and different master keys. You can regenerate keys any time from Azure Portal.|
|Non scalable||Highly scalable|
|Does not support larger data sets||Support for large data sets|
|Does not simulate consistency levels||Different Consistency levels available|
|Does not simulate multi-region replication||Configurable as part of the platform, as needed basis.|
|Does not support quota override feature||Supports document size limit increases, increased partitioned collection storage etc.|
|Might not support most recent changes to Cosmos Db platform||Most recent platform update will be available.|
Hope this article was helpful for your initial start. If you would need to understand further on Azure Cosmos DB development follow the links. I will be writing further insights in later sessions.
- Get started with Azure Cosmos DB’s DocumentDB API
- Get started with Azure Cosmos DB’s MongoDB API
- Get started with Azure Cosmos DB’s Graph API
- Get started with Azure Cosmos DB’s Table API