Setting App Configuration Values with Special Characters using Azure CLI
I recently ran into an issue when setting app settings via the “az functionapp config appsettings” command. The issue specifically occurs when there are spaces or special characters in the values:
az functionapp config appsettings set --name MyFunctionApp --resource-group MyResourceGroup --subscription MySubscription --settings "MyAppSetting=This has a # sign"
If you are running into the same issue, the solution is to put the whole command in a string and then call it with eval. This will ensure that the quotes are handled correctly and your settings will be applied successfully.
You can use the following code to set your app settings values:
settings="\"My App Setting=This has a space\" \"Another App Setting=This has a # sign\""
eval "az functionapp config appsettings set --name MyFunctionApp --resource-group MyResourceGroup --subscription MySubscription --settings $settings"
Using eval command will correctly handle the quotes and enable you to set values with spaces or other special characters.
I initially found the solution in this stackoverflow article: https://stackoverflow.com/questions/57762136/azure-cli-az-functionapp-config-appsettings-space-in-appsetting