Search code examples
azure-cliazure-app-configuration

Azure App Config adding JSON through Azure CLI


I've created an Azure App Config and am calling the following to add a key / value pair through an Azure Cloud Shell:

az appconfig kv set -n $appConfigName --content-type application/json --key "tenantXYZ:1" --value {\"FilterConfig\":{\"ClientId\":\"GHRYWQAXCFGH\",\"Url\":\"http://localhost:9091\"}}

but i get the following error

parse error

what's the correct syntax for adding a JSON object called FilterConfig with ClientId and Url properties ? I'm able to add this type ok via the Portal but need to be able to do it on the command line also.


Solution

  • @auburg, you should put the whole value in quotes

    az appconfig kv set -n $appConfigName --content-type application/json --key "tenantXYZ:1" --value "{\"FilterConfig\":{\"ClientId\":\"GHRYWQAXCFGH\",\"Url\":\"http://localhost:9091\"}}"