Developing Locally with Azure Cosmos DB
| March 26, 2019 | in
Azure Cosmos DB is a fantastic technology. It provides a very robust document database with multiple query languages supported.
But as with many cloud technologies, it has the problem of only being able to run from the cloud (obviously). Thankfully, some cloud technologies – like Cosmos DB – can be run on the ground, on developer machines.
Microsoft provides the Azure Cosmos DB emulator, which allows developers to run Cosmos DB on their machines and enable them to run instances independently.
Not only is the emulator simple to install, but it also provides a management console for interacting with Cosmos DB locally. I would recommend the Windows emulator for most users, but there is also a Docker version available (although the Docker version requires a little more work for a developer but provides similar features). Both the emulator and the Docker version only run on Windows machines.
The emulator will actually kick up a web page providing connection details. You can use the supplied connection string to create a connection from your .NET code, just like you would a Cosmos DB running in Azure Cloud.
An easy way to test this is with the Azure Storage Explorer. This is a really nice product that allows for looking at Azure storage options, including Cosmos DB. And it can connect to Azure Cosmos DB running locally on your machine.
What isn’t great about this option? The only drawback that I’ve encountered is that it only runs on Windows. This makes development difficult for many developers like me who spend the majority of their time on Mac or Linux machines.
Tell me about your experiences with the Azure Cosmos DB emulator. Hit me up on Twitter or share in the comments below.