Skip to content

Instantly share code, notes, and snippets.

@harshithjv
Last active June 10, 2020 11:13
Show Gist options
  • Select an option

  • Save harshithjv/3a408645762d4e61b2a23db1cf16fce5 to your computer and use it in GitHub Desktop.

Select an option

Save harshithjv/3a408645762d4e61b2a23db1cf16fce5 to your computer and use it in GitHub Desktop.

Reference

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

Change to Emulator's installed location

Below is the cd command to navigate to default installation directory of the emulator:

C:\> cd "C:\Program Files\Azure Cosmos DB Emulator"

Run emulator with remote access

The /GenKeyFile=<key_filename_with_path> is run as a stand-alone option which generate new token/key onto specified keyfile. The file can be used with /KeyFile=<key_filename> option later to start the service. Or the content of file can used with /Key=<key_string> directly to start the service.

The /AllowNetworkAccess option allows network access to emulator service. Its basically sets host to '0.0.0.0' instead of '127.0.0.1'(or localhost). Need to provide /KeyFile or Key option along with option.

The /Key=<key_string> can be used while starting the service with previously generated token/key by command run with /GenKeyFile option. The default key for local emulator is: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== and can be used along with /AllowNetworkAccess option for default connection key.

The /EnableMongoDbEndpoint enables listening port for MongoDb. Only then you can access the database with MongoDB features in the emulator service through Mongo DB connection string.

Below is the full command to start the service with remote access on LAN:

C:\Program Files\Azure Cosmos DB Emulator>Microsoft.Azure.Cosmos.Emulator.exe /AllowNetworkAccess /EnableMongoDbEndpoint /Key=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment