0

Get the DB strings from app.config with C# in Azure function.

In the below way I am accessing the strings:

var Conn = ConfigurationManager
                   .ConnectionStrings["ConnString"].ConnectionString

Looking for the good method to get control of database with conn strings.

Vidd
  • 13
  • 4

1 Answers1

0

Using Configuration Manager is recommended when using Asp.Net Core Configuration System in an azure function.

You can access it via the GetConnectionString from the ConfigurationBuilder

var connectionString = config.GetConnectionString("SqlConnectionString");

Follow this link to add the configuration in your project - https://blog.jongallant.com/2018/01/azure-function-config/

Ran Turner
  • 14,906
  • 5
  • 47
  • 53
  • hey, thanks.. this is helpful.. Also I've gone through another SO which is related to this question. Adding it here so that it can help someone. https://stackoverflow.com/questions/37215069/azure-functions-database-connection-string – Vidd Dec 29 '21 at 04:18