We were working on a project requiring us to extract data from an API and land it over a data lake storage account container. So, we created an Azure Function App using Visual Studio (VS) code. We set up an environment for the variable using the SETX command locally. While debugging the code, we got an error – “connect ECONNREFUSED 127.0.0.1:9091”, and “on prompt”, it suggested opening “launch.json.”
After going through the error message on the Terminal Tab, we recognized the root cause of the error: “The keyring does not contain a valid default protection key. The data protection system cannot create a new key because auto-generation of keys is disabled”.
The Solution:
To fix the issue, we used the “dotenv module” for the environment variable and added the necessary “Certificates” from Snap-in from the console root. To add certificates, these are the steps we have followed:
Step 1: Start → Run → MMC
The Console Root Window will Open Up:
Step 2: File → Add/Remove Snap-in
Step 3: Select certificates from the available snap-ins tab and then click Add to add-in the selected snap-ins tab
Step 4: Click Ok
Step 5: Close and Save the console file with the same settings
Step 6: After saving the console file, restart the system, and the system will be ready to run the Azure Function App in VS code