I'm playing around with a small ASP.NET Core 1.1 app which I have published. Now I'm following the documentation with regards to using appsettings*.json and environment variables. So I have the following:
appsettings.json
appsettings.Development.json
Each appsettings*.json file has an appropriate "ConnectionStrings:"
section:
"ConnectionStrings": {
"IdeasDatabase": "Server=tcp:adb.database.windows.net,1433;Initial Catalog=db;Persist Security Info=False;User ID=a_user;Password=apwd;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
}
So, when I published to begin with to Azure, I used a default connection string in the Publish settings (which was wrong I know), now this is showing in Azure remote settings for the my app:
The above connection string was populated on my first publish in this screen (Publish Wizard):
Now my Production app seems to be using this setting in the above image and not taking the setting from my appsettings.json
connection string section.
My appsetting.json
file is present on Azure App Service:
I know I can override that Database connection string in the Publish wizard tot the correct string, but shouldn't Azure take the Connection String first from my appsettings.json
file which is different from wherever it is storing it on Azure.