I am using .NET 6.0, in the project I have appsettings.json file with the following line:
"ConnectionStrings": {
"SqlConnection": "Server=.\\SQLEXPRESS;Database=XXX;Trusted_Connection=True;MultipleActiveResultSets=true"
},
In Azure I have Connection Strings defined as follows:[]1
When I check appsettings.json in xxx.scm.azurewebsites.net/wwwroot I can see that it still uses ConnectionStrings defined in my project's appsetting.json but not in the Azure one.
My Dbcontext:
services.AddDbContext<MyContext>(
options => options.UseSqlServer(Configuration.GetConnectionString("SqlConnection")));
How I get to Azure overwrite my connection string and use it instead? Thanks.
The App Service will not change your appsettings.json file. It will inject any app settings (including Connection Strings) in addition to your appsettings.json file into your application (as ENV vars).