4

I am trying to access Azure Cosmos DB Emulator through a Mac. The emulator is installed on Windows 10 machine. Both machines are obviously part of the local network. I am able to browse the emulator explorer on Windows 10 machine using the following addresses:

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

2) https://192.168.0.104/_explorer/index.html

However I am not able to browse the emulator explorer on Windows 10 machine using the following address:

1) https://192.168.0.104:8081/_explorer/index.html

I am getting following error message in browser:

The site can't be reached.

<192.168.0.104> refused to connect.

Same is the error message I am getting when I browse through Mac.

I have tried the following: 1) Activate "Private" firewall. 2) Turn off "Private" firewall. 3) Create a rule in firewall to allow inbound connections on port 8081. 4) Turn off all kinds of firewalls (Private, Domain, Public)

If anyone has tried to this before, please suggest what am I doing wrong or if it is even possible?

Himanshu Kumar
  • 541
  • 5
  • 14

2 Answers2

4

Use following command to generate a authorization key:

1) Microsoft.Azure.Cosmos.Emulator.exe /GenKeyFile=cosmosdbauthkey

2) Then shutdown the emulator if it is already running.

3) Then delete the emulator’s data directory at following location:

(C:\Users\user_name\AppData\Local\CosmosDBEmulator)

4) Restart the emulator with following command:

CosmosDB.Emulator.exe /AllowNetworkAccess /KeyFile=cosmosdbauthkey

Refer: https://learn.microsoft.com/en-us/azure/cosmos-db/local-emulator#command-line-syntax

Himanshu Kumar
  • 541
  • 5
  • 14
  • Following the process outlined/linked above, breaks creating databases and containers in the Explorer UI. `{"code":401,"body":{"code":"Unauthorized","message":"The input authorization token can't serve the request. Please check that the expected payload is built as per the protocol, and check the key being used. ..." – t.j. Mar 30 '21 at 20:55
  • @t.j. When you do this, you have to use the generated key (just look at the cosmosdbauthkey file content) instead of the default one (presented in the data explorer) – Marco Pelegrini Dec 22 '21 at 01:43
  • @t.j., I solved that by replacing the contents of the generated file by default emulator primary key. – Robert Mrobo Feb 19 '22 at 14:53
  • This answer could be improved by explaining what exactly is deleted with the data directory. Is it just configuration details? Or will you lose your databases, containers, and documents? – Rob Mosher Jul 20 '23 at 14:08
  • @RobertMrobo I'm guessing they direct you away from using the default key for security since you're exposing the emulator to a network. But I can confirm changing generated keyfile to have the default key fixes the Data Explorer issue. I'm not particularly concerned as I'm only attempting to give WSL access. – Rob Mosher Jul 20 '23 at 14:11
0

Try installing the Cosmos DB emulator using the NoFirewall command.

CosmosDB.Emulator.exe /NoFirewall

Nick Chapsas
  • 6,872
  • 1
  • 20
  • 29