Load Connection String from Config File in Azure Functions

前端 未结 6 1738
伪装坚强ぢ
伪装坚强ぢ 2020-12-20 13:09

In my Azure Function I am using a Library which establishes a connection to an SQL server via the ConnectionString from the ConfigurationManager like this:

v         


        
6条回答
  •  一个人的身影
    2020-12-20 13:42

    // C# Environment Variables example for Azure Functions v1 or v2 runtime
    // This works all the way up to but not including .NET Core 2.0
    var clientId = Environment.GetEnvironmentVariable("ClientId");
    var clientSecret = Environment.GetEnvironmentVariable("ClientSecret");
    var aadDomain = Environment.GetEnvironmentVariable("AADDomain");
    

    Please do remember the settings you do in local.settings.json will not be reflected in azure. Please add your values in app setting from Azure portal follow the link- https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings

提交回复
热议问题