1

I use an Azure function and set the environment variables via PowerShell with the command: az functionapp config appsettings set --resource-group $myResourceGroup --name $myAzureFunction --settings @appSettingsAsArray.

This works well until special characters e.g are in a secret.

I debugged my PowerShell script and all signs are processed correctly from the script and the execution of the command to set the appsettings was successful too.

If I open the Azure Portal and have a look about the appsettings of the Azure function I can see the secret/value is different to the secret/value which was set by the PowerShell script.

So it looks like during the command Azure replaces/removes special characters like: '^', '`'.

I tried it with such a secret: like => '=P^1tUbdw_G`Ci'I6T°10~rhlQR' and the secret in the function is: => '=P1tUbdw_GCi'I6T°10~rhlQR'.

In this case the signs '^', '`' are being removed.

In case the secret/value has an '&' character Azure will cut everything afterwards.

Any ideas what I can do about this to use a secret/value with such signs? I know one option would be to use another secret, but it would be beneficial to know how I can handle it with such signs in a value.

Kate Orlova
  • 3,225
  • 5
  • 11
  • 35
Changer
  • 85
  • 1
  • 7

1 Answers1

1

Backtick and caret are special signs in powershell, so they should be escaped with another backtick.

=P`^1tUbdw_G``Ci'I6T°10~rhlQR
Wasif
  • 14,755
  • 3
  • 14
  • 34