Azure Function Publish local.settings.json Value Formatting

상준 이 251 Reputation points
2021-09-16T06:26:22.977+00:00

I'm curious about the setup when publishing an Azure Function App via Visual Studio 2019.
Let's take an example local.settings.json.

{
  "IsEncrypted": false,
  "Values": {
    "MySetting1": "asdfsdf",
    "MySetting2": {
      "MySetting2-1": false,
      "MySetting2-2": false,
    }
    "MySetting3": [
      "asdfsadf",
      "asdfajlwsenr",
      "awerjlnwaesrsdfsd"
    ]
  }
}

How can I input through Visual Studio in the form above?
I found the method below, but do I have to set the config file only in the style below?

https://stackoverflow.com/questions/47025999/how-to-set-an-array-value-in-local-settings-json-file-in-azure-functions

"MySetting2:MySetting2-1": false,
"MySetting2:MySetting2-2": false,
"MySetting3:[0]:key1": "asdfsadf",
"MySetting3:[1]:key2": "asdfajlwsenr",
"MySetting3:[2]:key3": "awerjlnwaesrsdfsd",

Do I have to create each setting value in one line like the example in the link above?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,298 questions
Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
208 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 68,641 Reputation points
    2021-09-16T07:49:28.493+00:00

    @상준 이 The settings are key value pair and you cannot use value as arrays but you can define something value like array having key value pair. Yes your understanding is correct how you define in your example.

    "MySetting3": [  
          {  
            "key1": "value1",  
            "key2": "value2"  
          },  
          {  
            "key1": "value3",  
            "key2": "value4"  
          }  
        ]
    

0 additional answers

Sort by: Most helpful