Updating appsettings.json values in azure deployed application

2.6k views Asked by At

I've went through different answers before posting my question, but I need some assistance in order to resolve the issue. This is sample of the appsettings I have deployed:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=tcp:mywebdb.windows.net,1433;Initial Catalog=mydb;User ID=myuserid;Password=mypass;"
  },
  "Clients": [
    {
      "ClientId": "spa",
      "ClientName": "SPA Client",
      "AllowedGrantTypes": [
        "authorization_code"
      ]
      "RedirectUris": [
        "http://localhost:4200/callback",
        "https://localhost:4200/callback",
        "http://localhost:4200",
        "https://localhost:4200",
        "http://localhost:4200/auth/login",
        "https://localhost:4200/auth/login",
        "https://google.com",
        "https://bing.com",
        "https://test.com",
        "https://nba.com"
      ],
      "PostLogoutRedirectUris": [
        "http://localhost:4200/auth/login",
        "https://localhost:4200/auth/login"
      ],
      "AllowedCorsOrigins": [
        "http://localhost:4200",
        "https://localhost:4200"
      ]
    }
  ]
}

I would like to overwrite the values in the "RedirectUris" and "AllowedCorsOrigins" arrays, I tried something like this Clients:RedirectUris:8 in the application settings in azure but it doesn't work. Should I do something else or additional in order to have this working?

2

There are 2 answers

0
Zhi Lv On

Check the article: Configure an ASP.NET Core app for Azure App Service:

If you configure an app setting with the same name in App Service and in appsettings.json, for example, the App Service value takes precedence over the appsettings.json value. The local appsettings.json value lets you debug the app locally, but the App Service value lets your run the app in product with production settings. Connection strings work in the same way. This way, you can keep your application secrets outside of your code repository and access the appropriate values without changing your code.

Reference:

Configure an App Service app in the Azure portal

ASP.NET Core AppSettings for Azure App Service

0
Nicklaus Brain On

Each configuration source (configuration provider) should be configured in the application itself:

See general guideline here:

Azure App configuration provider in particular, is described here: