Search code examples
azure-web-app-serviceazure-webapps

Azure Portal Application Settings for Container App Service


I'm not able to update the application settings in the Azure portal to override my .net core appsetting file.

I've been following the instructions from this MS doc - https://learn.microsoft.com/en-gb/azure/app-service/configure-common

I pushed my container from Azure Container Registry an azure app service (Windows OS)

My appsettings file looks like this (The value is empty as I always want to inject the value using the Azure Portal)

AppSettings

I have given the setting a value in the portal

Portal settings

The setting is not being picked up when I deploy the app. I have tried restarting a couple of times. I have checked in the Kudu console and can see the app setting there.

Just to add, further docs mention that this should work in web apps for containers - https://blogs.msdn.microsoft.com/waws/2017/09/08/things-you-should-know-web-apps-and-linux/#SetEnvVar enter image description here

Am I missing something?


Solution

  • When you publish your app to Azure, it is no matter with your .json file. If you add the key-value in AppSettings, it is setted. So I guess it is wrong with your code of getting the AppSettings Value, that doesn't mean the AppSettings is not setted.

    And this is the Way of getting AppSettings(like "MyAppSetting": "12345"):

    var environmentmyDesiredKey = Environment.GetEnvironmentVariable("MyAppSetting");
    

    This is what I set on the portal:

    enter image description here

    And with the code above, I can get the AppSettings successful.

    enter image description here

    Let me know if you have doubts.