azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Webapp:Multiple bugs - `az webapp config appsettings set` command

Open flyingUnderTheRadar opened this issue 5 years ago • 7 comments

Facing two problems

  • az webapp config appsettings set -g $ResourceGroupName -n "app-name" --settings SettingKey=$SettingValue SettingKey2=$SettingValue2 does not work even though the settings are space separated, it errors out. If it is set as a string it puts all of it in the one config setting (with the "()" for keyvault reference. This is relevant for the next problem.)
  • az webapp config appsettings set -g $ResourceGroupName -n "app-name" --settings SettingKey=$SettingValue - Does not work properly if the $SettingValue is a keyvault reference. It sets the value in the web app but omits the last ')' causing it to not be a valid keyvault reference string.

I know this is an avenue is for page feed back, but please let me know who I can get in touch with to resolve this issue on the product itself.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

flyingUnderTheRadar avatar Jul 29 '20 19:07 flyingUnderTheRadar

Service attention and for webapp

flyingUnderTheRadar avatar Jul 29 '20 19:07 flyingUnderTheRadar

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

ghost avatar Jul 30 '20 01:07 ghost

@flyingUnderTheRadar Can you try putting quotations around your settings like so: --settings 'SettingKey=$SettingValue' 'SettingKey2=$SettingValue2' and let me know if the problem still persists

calvinsID avatar Aug 27 '20 01:08 calvinsID

Appreciate your response. Ended doing doing something different. Don't have it set up to test anymore.

However just for others I ended up having to use powershell like this to make it work

$SecretKVReference= '"@Microsoft.KeyVault(SecretUri={0})"' -f $SecretString
$AnotherSecretKVReference= '"@Microsoft.KeyVault(SecretUri={0})"' -f $AnotherSecretString

az webapp config appsettings set -g $ResourceGroupName -n $WebAppName `
    --settings SecretString=$SecretKVReference AnotherSecretKVReference=$AnotherSecretKVReference

flyingUnderTheRadar avatar Aug 28 '20 00:08 flyingUnderTheRadar

@flyingUnderTheRadar Can you try putting quotations around your settings like so: --settings 'SettingKey=$SettingValue' 'SettingKey2=$SettingValue2' and let me know if the problem still persists

Correction: I know this is a pretty old issue, but this solution doesn't work actually... When you single quote, the $settingValue doesn't get resolved any more.

alexdrenea avatar Nov 09 '21 14:11 alexdrenea

Correction: I know this is a pretty old issue, but this solution doesn't work actually... When you single quote, the $settingValue doesn't get resolved any more.

This works for me:

--settings DB_PASS='"@Microsoft.KeyVault(VaultName='$kv';SecretName=DbPassword)"'

anmalkov avatar Dec 17 '21 01:12 anmalkov

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

ghost avatar Aug 10 '22 20:08 ghost