Grace
Grace

Reputation: 11

az functionapp config appsettinggs set: Will not allow me to use a variable in --settings parameter

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  "[email protected](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".

Upvotes: 1

Views: 482

Answers (1)

Thomas
Thomas

Reputation: 29791

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:

`""[email protected](VaultName=${keyvault};SecretName=CacheConnection)"`"

Upvotes: 0

Related Questions