Reputation: 43
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.
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
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