Azure / azure-cosmos-dotnet-v2

Contains samples and utilities relating to the Azure Cosmos DB .NET SDK
MIT License
577 stars 837 forks source link

Failed to acquire private key for emulator secrets certificate #693

Closed krishnagupta21 closed 5 years ago

krishnagupta21 commented 5 years ago

Describe the bug When I try to run CosmosDB.Emulator.Exe I get the following error:

Failed to acquire private key for Emulator secrets certificate Error: 0x80090015

I have tried uninstalling, deleting all files AppData/Local/CosmosDbEmulator and in Program Files/Azure Cosmos Db Emulator and reinstalling it. I have also tried lodctr /r multiple times. and also tried CosmosDbEmulator /starttraces before starting CosmosDbEmulator

To Reproduce I uninstalled an old version and reinstalled the latest version (2.2.1-2).

Expected behavior The emulator should start

Environment summary SDK Version: 2.2.1 OS Version: Windows 10-64 bit

krishnagupta21 commented 5 years ago

I was able to fix it by deleting all certificates (using Certificate Manager) related to DocumentDbEmulator and CosmosDbEmulator

josh-yates commented 5 years ago

Hi @krishnagupta21 - I have run into the same issue as you. I followed your advice of deleting all certificates related to DocumentDbEmulator and CosmosDbEmulator and am now receiving

Failed loading Emulator secrets certificate.

Did you encounter this? How did you go about deleting certificates? Any advice you could give would be greatly appreciated - I've hit a brick wall here! Thank you.

DinoSourcesRex commented 1 year ago

@josh-yates I know this is several years after the fact but for anyone who finds their way here if they encounter this the fix is relatively simple on Windows.

Press Windows Key + R and type in certlm.msc for the local certificates on the machine.

You will be looking at the "Friendly Name" column, the values you care about are the ones mentioned above - CosmosDbEmulator and DocumentDbEmulator.

Option 1 - Find

Go to "Action > Find Certificates..." in the task bar on the certificate manager.

Search for localhost in the field Issued By.

The list should contain the certs you care about.

Option 2 - Manually search

Here you should look manually for the certificates that have the friendly names you care about. I found some in the following places, all issued to localhost.

Hope this helps someone.

indupriya123 commented 7 months ago

@krishnagupta21 @DinoSourcesRex

I still see this issue after deleting all the certs related to emulator. How to solve this?

image

HermanCordes commented 2 weeks ago

@indupriya123 @krishnagupta21 @DinoSourcesRex After following the walkthrough by @DinoSourcesRex, I'm running into the same issue as @indupriya123. Did anyone manage to resolve this issue?

I tried the obvious thing of removing the application and reinstalling, but that doesn't solve the issue and it also doesn't bring back the deleted certificates.

Curious to if someone found a definitive solution?