Azure Cosmos DB Emulator and Storage Emulator

Azurite emulator provides a free local environment for testing your Azure blob, queue storage, and table storage applications. Find more details in

Cosmosdb emulator provides a local environment that emulates the Azure Cosmos DB service for development purposes. Using the Azure Cosmos DB Emulator, you can develop and test your application locally. You can develop applications using Azure Cosmos DB Emulator with the SQLCassandraMongoDBGremlin/Graph, and Table API accounts. Currently the data explorer in the emulator fully supports viewing SQL data only; the data created using MongoDB, Gremlin/Graph and Cassandra client applications it is not viewable at this time. 

Creating docker-compose.yml file

version: '3.4'

    container_name: cosmosdb
    image: ""
    tty: true
    restart: always
    mem_limit: 3g
    cpu_count: 2
        - "8081:8081"
        - "10251:10251"
        - "10252:10252"
        - "10253:10253"
        - "10254:10254"
        - vol_cosmos:/data/db

    container_name: azurite
    image: ""
    restart: always
        - "10000:10000"
        - "10001:10001"
        - "10002:10002"
        - vol_cosmos:/data


Running Emulators with docker


export HOST_IP="`ifconfig | grep "inet " | grep -Fv | awk '{print $2}' | head -n 1`"

docker-compose up

Create file and run the following command.

. ./

I faced some issues when I work with Cosmos DB emulator. Somehow I couldn't create database so to solve this problem, I was deleting Cosmos DB container then creating again.

docker rm -f cosmosdb

Downloading and Adding Cosmos DB Emulator Self-signed Certificate for MacOS

This script will download self-signed certificate from Cosmos DB docker container and add in Keychain Access application in MacOS. If this self-signed certificate is not added in Keychain Access properly, then your application can't be connect Cosmos DB.


export HOST_IP="`ifconfig | grep "inet " | grep -Fv | awk '{print $2}' | head -n 1`"

curl -k https://$HOST_IP:8081/_explorer/emulator.pem > ./emulatorcert.crt

sudo security add-trusted-cert -d -r trustRoot -k ~/Library/Keychains/login.keychain emulatorcert.crt

You should be able to see localhost certificate as shown below screenshots.

Be sure that all these settings have Always Trust as selected.

Cosmos DB Emulator UI

You can now browse to https://localhost:8081/_explorer/index.html or https://{your_local_ip}:8081/_explorer/index.html and retrieve the connection string to the emulator.
Cosmos DB Connection string is AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==

Notice that below screenshot show `Primary Connection String` as Cosmos DB connection.

Creating and viewing Cosmos DB databases is in Explorer tab.

Microsoft Azure Storage Explorer UI

Leave a Reply