Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUGGESTION] Switch from using application setting files to .NET user secrets #42

Open
seesharprun opened this issue Oct 10, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@seesharprun
Copy link
Contributor

seesharprun commented Oct 10, 2024

Today, many code samples have you entire your Azure Cosmos DB for NoSQL endpoint and credentials using an application settings file. This presents a few risks:

  • This reinforces that saving your credentials in plain-text is a good idea (it's not)
  • Customers could inadvertently check in real credentials to their forks

I recommend that we use .NET user secrets. The secrets are persisted on the user's machine and are not available in the source code as plain text credentials.

For each project you would need to:

  1. The maintainers run dotnet user-secrets init on each original source project. It will add a non-sensitive GUID to the project. You just check in the project with the GUID so it "works" with .NET user secrets.
  2. When it's time for the customers to add their endpoint, just tell them to run dotnet user-secrets set CosmosUri "<nosql-account-endpoint>"
  3. For now, you can repeat the same step for keys. When they eventually migrate to Microsoft Entra authentication and RBAC, you can drop this additional step entirely
  4. Instead of modifying the C# project file, they can just run the project as-is.

FYI @markjbrown

@seesharprun seesharprun added the enhancement New feature or request label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants