Azure — Configure Application settings and Connection strings in Azure App Services
Azure App Service Configuration — Set App Settings and Connection Strings.
In .NET applications, we have option to save settings in web.config or in app.config file. But in .NET Core, you have option to save them in few other locations like appsettings.json, appsettings.<Environment>.json
and in secrets.json
.
One of the main reason settings are not saved in web.config file is, to avoid settings getting checked-into repository. By default appsettings.json file are ignored by repository clients.
Main difference between appsettings.json
and secrets.json
is the file location. appsettings.json is at the root of the source folder, but secrets.json file is at this location C:\Users\<username>\AppData\Roaming\Microsoft\UserSecrets\<project GUID>\secrets.json
Secrets.json file is available only for that specific user. This is controlled by OS. You can create this secrets.json file from Visual Studio, just right click on the project and select Manage User Secrets
.
Now when you deploy your ASP.NET Core website to Azure App Services, usually appsettings.json is not deployed (you don’t want others to download your secrets). So you have to use Azure Portal Application Settings
blade to upload your settings. There…