The configuration page of a Windows Azure Web Site has a "connection strings" section. The section lists connection strings for linked resources. How do we programmatically retrieve the connection string for a linked SQL Azure Database?
The configuration page of a Windows Azure Web Site has a "connection strings" section. The section lists connection strings for linked resources. How do we programmatically retrieve the connection string for a linked SQL Azure Database?
Getting the connection string as an environmental variable this way would seem to be the wrong way. You would define it under the connection string and then just call GetConnectionString from the IConfiguration interface, without making it more complex and prefixing with database strings.
Try the below this makes it much simpler
IConfiguration config = new ConfigurationBuilder()
.AddEnvironmentVariables()
.Build();
var connection = _config.GetConnectionString("DatabaseConnection");