appsettings

Don't delete AppSettings not declared in a template

限于喜欢 提交于 2021-02-07 05:27:35
问题 When deploying an Azure Function App and AppSettings via an ARM Template , is it possible to tell Azure not to delete AppSettings that are not declared in the template? For example, take the following AppSettings config from the template and imagine that I'm updating an existing Function App . In this case, an AppSetting called storageaccountname_STORAGE would be deleted, which is undesirable as (for example) it has been created to facilitate a binding. { "apiVersion":"2016-08-01", "name":

How to read appsettings.json with array of values

徘徊边缘 提交于 2021-01-28 18:16:31
问题 I have the following appSettings.json file: "SundrySettings": { "CookieName": "Cookie", "AccessGroup": "Software Development", "Terminals" : { "Raucherplatz" : "tablet1.local", "Service" : "tablet2.local", "Technik" : "tablet3.local", "Technik" : "tablet4.local", "Container" : "tablet5.local" } } } That I would like to load into the following structure: public class Terminal { public string Name; public string Description; } public class SundryOptions { public string CookieName { get; set; }

How to use |DataDirectory| substitution string in appsettings.json with asp.net core?

孤者浪人 提交于 2021-01-28 12:40:24
问题 I'm new to asp.net core and the task I want to do should be very simple. Using Visual Studio, I'm trying to link a .mdf file to my project as a local database. As I want to make it work for several computers, I need to find the data directory folder path from appsettings.json. Therefore, after some researches, the best way to do that is using the |DataDirectory| substitution string. The problem is that my website can't reach my mdf file this way and it generates an ArgumentException :

Override App.config value with an environment variable

流过昼夜 提交于 2020-12-08 06:26:26
问题 I have a C# console program that prints an App.config value. Can I override this value from an environment variable? In my real use-case, the value specifies a port to bind, and I need to run multiple instances of the program in my Jenkins server, so each one should have a different value even though they use the same config file. Example App.config: <appSettings> <add key="TestKey" value="Foo"/> </appSettings> Example Code: Console.WriteLine($"Key: {ConfigurationManager.AppSettings["TestKey"

Read values from local.settings.json in VS 2017 Azure Function development

我的梦境 提交于 2020-06-09 16:53:13
问题 I am writing an Azure function in VS 2017. I need to set up a few custom configuration parameters. I added them in local.settings.json under Values . { "IsEncrypted":false, "Values" : { "CustomUrl" : "www.google.com", "Keys": { "Value1":"1", "Value2" :"2" } } } Now, ConfigurationManager.AppSettings["CustomUrl"] returns null. I'm using: .NET Framework 4.7 Microsoft.NET.Sdk.Functions 1.0.5 System.Configuration.ConfigurationManager 4.4.0 Azure.Functions.Cli 1.0.4 Am I missing something? 回答1: