3

As far as I know we can store connection strings in azure Applications settings under Connection string section. My question is, can we store below configuration in Application settings.

"IdentityConfig": {
    "Authority": "http://myapp.azurewebsites.net"
  }

When I deploy application I don't want to change Authority value each time into different environments. This section belongs to appsettings.json file in a ASP.NET CORE project.

Damith
  • 1,982
  • 3
  • 28
  • 42
  • I think I found the solution in this page. https://blogs.msdn.microsoft.com/cjaliaga/2016/08/10/working-with-azure-app-services-application-settings-and-connection-strings-in-asp-net-core/ – Damith May 15 '18 at 13:49

1 Answers1

7

When developing an ASP.NET Core app and using app settings or connection strings in App Service, you need to name your settings so that it corresponds to your settings structure.

So this setting for example should have:

So you take all of the keys in the hierarchy and join them with colons.

Classic ASP.NET apps make the settings/connection strings directly available on ConfigurationManager at runtime. If the names of settings/connection strings exactly match those in web.config, the values set in App Service override the values at runtime.

Other frameworks and languages would typically use the settings as environment variables.

juunas
  • 54,244
  • 13
  • 113
  • 149
  • 2
    Just to be clear this is an ASP.NET Core specific implementation, other programming stacks simply read App Service app settings as environment variables (string verbatim, no hierarchy). – evilSnobu May 15 '18 at 19:51
  • App Service config doesn't allow colons, so to make this work, change to double underscores, example: AppSetting:AppUrl -> AppSetting__AppUrl – Alexandre Jan 18 '22 at 20:02