Shi Her
Shi Her

Reputation: 43

How to read appsettings.json from Azure Functions using Azure CLI PowerShell

I am using the Azure CLI to interact with my Azure Functions. I want to be able to read the appsettings.json file that was deployed with the function app. You can see this file if you're using the App Service Editor.

enter image description here

From what I have seen so far, I could use the az functionapp config appsettings set command but that will only read the appsettings on the function app and not the custom appsettings.json file.

How would one go in accomplishing this?

Upvotes: 0

Views: 1075

Answers (1)

suziki
suziki

Reputation: 14113

Although I don't recommend doing this on Azure, if you really want to know, I think this should meet your requirements:

Get the content:

$json = Get-Content 'appsettings.json' | Out-String | ConvertFrom-Json

Show the content:

$json

Add the value:

$json | Add-Member -Type NoteProperty -Name 'Key' -Value 'Value'
$json | ConvertTo-Json | Set-Content 'appsettings.json'

Upvotes: 2

Related Questions