In my last post, I talked about how we can extend the
FunctionsStartup class and override its
Configure method to register services. In this post, I’ll share how to go about using User Secrets and JSON file configuration.
If you want to use User Secrets, you must first add the
Microsoft.Extensions.Configuration.UserSecrets package from NuGet. This should also add a GUID in your project file. At this point, you can utilize User Secrets through Visual Studio or the .NET Cli as you normally would. One thing to note is that the code sample below calls the
AddUserSecrets() method. If you’re not going to use user secrets, skip this step and remove the call to the method (line 16).
For utilizing a JSON file, you want to go ahead and create the JSON file and the code sample below should work.