1

I am trying to give function configurations access to keyvault values. I want to use variables so I do not need to hard code values and can use it for multiple environments; however, when I use variables the parenthesis needed at the end of the value disappears because I can no longer use the stop-parsing parameter (--%) with the variable in the string. Is there a way to add the closing parenthesis at the end? Or is there a way to put a variable in the stop-parsing parameter? Or is there a totally different approach I should be using

I used this line below

az functionapp config appsettings set -g $resource_group -n $function_app --settings "CacheConnection=@Microsoft.KeyVault(VaultName=${keyvault};SecretName=CacheConnection)"

I expected my azure portal fucntionapp configuration to contain the name ("CacheConnection") and the value "@Microsoft.KeyVault(VaultName=${keyvault};SecretName=CacheConnection)"), which it does. It just does not contain the closing parenthesis which will be needed. For the value it shows "@Microsoft.KeyVault(VaultName=${keyvault};SecretName=CacheConnection".

Grace
  • 11
  • 1

1 Answers1

0

As explained here:

Add additional double quotes for force powershell to treat the argument as a literal

So in your case that should look like that:

`""CacheConnection=@Microsoft.KeyVault(VaultName=${keyvault};SecretName=CacheConnection)"`"
Thomas
  • 24,234
  • 6
  • 81
  • 125