Home > Net >  Azure staticwebapp not allowing to add config with "&" in value using Azure CLI in termina
Azure staticwebapp not allowing to add config with "&" in value using Azure CLI in termina

Time:09-06

I am using Azure CLI to use the azure. I am trying to create a staticwebapp and later try to add the configuration from CLI.

I tried to run this

az staticwebapp appsettings set -n appname --setting-names MONGO_CONNECTION_STRING="mongodb srv://anirudha:[email protected]/?retryWrites=true&w=majority"

I am getting error

'w' is not recognized as an internal or external command,
operable program or batch file.

I go to portal and seen before &w=majority is added into configuration but this part is not added after &.

I tried to put singlequote and key=("val") but none of them working for me. I found this in azure app config github repo.

Anyone have idea how to make it work from CLI

enter image description here

enter image description here

CodePudding user response:

--setting-names property accepts the app settings in 'key=value' format as mentioned here in enter image description here

Updated Answer:

Alternatively, you can use this PowerShell cmdlet (New-AzStaticWebAppSetting) to update the app settings of the static web app

New-AzStaticWebAppSetting -ResourceGroupName resourceGroup -Name staticweb01 -AppSetting @{'function01' = 'value01'; 'function02' = 'value02' }
  • Related