Reputation: 213
I want to compare the Application settings of two differents function app. I have one function app for the development and an other for the production and I want to check if I don't forget to add one setting on production.
I started with the Azure CLI and did :
az functionapp config appsettings list
which returns the list of the application settings.
Now how can I compare the names of the settings (not the value which will be different) of the two function apps ? It is possible to store them in a two differents output table
and compare the name
column ?
Upvotes: 1
Views: 625
Reputation: 59021
Here a solution using PowerShell Core where I first retrieve both appsettings (stage and prod). Then I iterate over the stage appsettings and check whether I find the same setting on the prod instance:
$stage = az functionapp config appsettings list -g my-rg-01 -n my-func-01-stage | ConvertFrom-Json
$prod = az functionapp config appsettings list -g my-rg-01 -n my-func-01-prod| ConvertFrom-Json
$stage | Foreach-object {
if (-not $_.Value -eq ($prod | Where-Object Name -eq $_.Name).Value) {
Write-Warning "Missing value or invalid value for key $($_.Name) found"
}
}
Upvotes: 1