app setting with a hyphen doesn't work with task Azure App Service deploy v4

Yanis Kross 1 Reputation point
2024-05-10T14:00:11.24+00:00

I'm using Azure App Service deploy version 4 in azure devops and I'm trying to set an app setting to a value that starts with a hyphen/dash. The value is coming from the vault/group variable

The setting is as follows -PRIVATE_KEY $(key-private). When the pipeline runs it will evaluate the variable to -PRIVATE_KEY -----BEGIN PRIVATE and it fails saying that the value can't start with "-----BEGIN".

If I set it with quotes -PRIVATE_KEY "$(key-private)" it does work but it gets deployed with the quotes. I don't want the quotes in my variable.

If I go to advanced edit in the web app I can see the following:

{
    "name": "PRIVATE_KEY",
    "value": "\"-----BEGIN PRIVATE\"",
    "slotSetting": false
  },

But I want the following end result, notice no quotes.

{
    "name": "PRIVATE_KEY",
    "value": "-----BEGIN PRIVATE",
    "slotSetting": false
  },

How can I do this with the that task?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,069 questions
{count} votes