There is an Azure CLI v2 task in one of my Azure DevOps release pipelines. Its Script Type
is set as Shell and Script Location
is set as Inline Script. I am trying to pass a script argument with spaces to an environment variable defined within the script. I am very simple version of my Azure CLI script is below:
az container create --resource-group $(resourceGroup) BLA BLA BLA --environment-variables 'DOTNET_ENVIRONMENT'=$1 'ConnectionStrings__MyDatabase'=$2
ANd in the Script Arguments section I provide args like this:
'$(TargetEnvironment)' `$(ConnectionStrings.MyDatabase)`
Single quotes or double quotes, it doesn't matter because the generated ConnectionStrings__MyDatabase
variable is truncated till the first space. For example instead of "Server=tcp:dev.database.windows.net,1433;Initial Catalog=Employess;" it is only "Server=tcp:dev.database.windows.net,1433;Initial".