How To Store Secrets For Local Development
HTML-код
- Опубликовано: 8 фев 2025
- 💻Watch the full tutorial: • ASP.NET Core Tutorial ...
Are you storing your connection strings or secret keys in your appsettings.json file? Are you aware of the dangers of doing this? Is there a better way?
In this video I explain how to use .NET’s Secret Manager to safely store your application secrets during local development.
🔥Become a Senior C# Backend Engineer: juliocasal.com...
🗺️Get My Free .NET Backend Developer Roadmap: juliocasal.com...
Join me on Patreon: / juliocasal
Follow me on LinkedIn: / juliocasal
Follow me on X: x.com/julioc
#csharp #dotnet #aspnetcore
Quality Content mate,thank you
Glad you enjoyed it!
Thanks a lot for this video, it is very helpful. I would like to know how we can set a similar configuration but using an azure key vault with a MongoDB database.
Great suggestion!
But secret manager work on stage and production environments?
No, this is just for your local dev box. For anything beyond that you want to use a secure cloud location like Azure Key Vault.
@@juliocasal so if i want to use secret manager but with the option to control the db connection string (sometime i will want to work against stage and not local) so how can i achieve this?
@orturjamen9689 option 1 change the connection string to stage db in current secretmanager json.
Option 2, create another copy of secret manager json with a different guid, change the db connection string.
Can i use secrets. json values in bdd test cases? Like clientid and client secrets?
You should not, it's not meant for that.
Great content ! I’m wondering how to use it if we use in the ASPNET_CORE Env variable instead of “Development” , “Local” , or something else , I have been in those scenarios and the secret manager doesn’t work in those cases. Recommendation here ??
Orney, you should be able to call AddUserSecrets youself, instead of letting WebApplication.CreateBuilder() call it for you (which happens only in "Development" environment). Like this:
builder.Configuration.AddUserSecrets();