Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appsettings.json files or App Service - App Settings in Azure Portal?

I have so far used the appsettings.{environment}.json files to keep application level configuration settings. Now I encounter this tab in Azure Portal for an App Service.

What is the difference between using the appsettings.json files and "Application Settings" Tab in the Azure Portal? And which one to use When?

enter image description here

like image 359
blogs4t Avatar asked Dec 06 '25 07:12

blogs4t


1 Answers

Few reasons to use Azure Application Settings -

1st - Let's assume that in order to avoid leaking configurations in appsettings.json, you aren't committing it to your repo. But you also deploy your web app on Azure AppServices. In this situation Application Settings tab can help you to configure your configurations directly and then Azure will auto create appsettings.json by reading those values.

2nd - This time we are committing appsettings.json and deployed web app on Azure. We also have a property as

{
  "Users": {
     "CanAccessApp": [ "[email protected]", "[email protected]" ],
     "CanAccessHangfire": [ "[email protected]", "[email protected]" ],
     "CanAccessLog": [ "[email protected]", "[email protected]" ]
   }  
}

Now, I also want one more user to be able to access logs. How you will do it? Generally, update in your appsettings.json and redeploy.

Or you can create similar property in Application Settings by

Users:CanAccessLog:0 -> [email protected]
Users:CanAccessLog:1 -> [email protected]
Users:CanAccessLog:2 -> [email protected]

and so on where 0,1,2 are indexes of the array (Azure style). This one will help us to test quickly without redeploying or modifying appsettings.json.

like image 75
Vikram Singh Saini Avatar answered Dec 08 '25 21:12

Vikram Singh Saini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!