I have a Web API in .NET 6 that uses the standard IConfiguration
to get config/settings values from appsettings.json
and is deployed to Azure App Service (Windows).
I’m deploying it with Visual Studio and I can see the code being updated in App Service. However, my changes in the appsettings.json
were not reflected in the App Settings tab of the Environment variables page (in the Settings section). Note that the appsettings.json
inside App Service was updated (I verified this with Kudu).
I don’t know how the previous developer created those environment variables (one for each value in appsettings.json
).
- Is that something that I have to manually add/update?
- Is there a tool to automate the mirroring of the new entries in
appsettings.json
and create the corresponding environment variables? - I tried publishing the
appsettings.json
by right-clicking on it in Visual Studio Solution Explorer and then clicking on thePublishing appsettings.json
menu item, but that didn’t seem to work. Am I using that menu item incorrectly? - I see that there is a “Pull reference values” button in the Environment variables page, from the few Google results, it seems like that would be to pull updated values from Key Vault. Is this correct?
- This is the first time that I see environment variables being used in lieu of settings that are already defined in
appsettings.json
. I know that for some settings (e.g., sensitive values like tokens/API keys), it might be a way to avoid having those values on disk, but in this project, every single setting is being duplicated. Is this a common/standard thing to do? I usually just copy/deploy all theappsettings.<env name>.json
for each environment and just set theASPNETCORE_ENVIRONMENT
variable to match the<env name>
.
Answers to any/all questions above will be appreciated, I’ve read several documentation pages of Azure App Service and none mention of a tool/way to automate creating as may env vars as I have in this project. I want to think that the previous developer was not crazy enough to manually create/keep updated each one manually.