question

18253371 avatar image
0 Votes"
18253371 asked MayankBargali-MSFT commented

Azure Function Publish local.settings.json Value Formatting

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-functionsazure-app-configuration
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT commented

@18253371 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"
       }
     ]
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the quick reply.

If so, is it possible to set the local.settings.json setting value to an Azure Function in Visual Studio only by writing one line unconditionally?

0 Votes 0 ·

@18253371 I haven't tried it out. I will test it at my end and share my analysis.

1 Vote 1 ·