Custom script extension incorrectly processing input characters

Gregory Suvalian 186 Reputation points
2021-03-29T03:21:29.763+00:00

Hello,

Custom script extension for Windows seems to be incorrectly processing characters passed to it. Relevant portion of my script extension is below

"commandToExecute": "[concat('powershell.exe -file ./consolidated-webserver/server.prep.ps1 ', ' -clients ', variables('convertedJSON'))]"

variables('convertedJSON') contains string with various characters which is correctly passed to extension which can be seen by examining file under Status folder as seen below

"powershell.exe -file ./consolidated-webserver/server.prep.ps1 -clients ^\"{'clients':[{'clientName':'dominos','sqlreference':{'keyVault':'dominos-urbumyyogx-kv','fdqn':'venio-dominos-sql.eastus.cloudapp.azure.com'}},{'clientname':'boeing','sqlreference':{'keyVault':'boeing-c4uujz4qkc-kv','fdqn':'venio-dominos-sql.eastus.cloudapp.azure.com'}}]}^\""

Actual powershell instance is launched though with following parameters -

Host Application: powershell.exe -file ./consolidated-webserver/server.prep.ps1 -clients {'clients':[{'clientName':'dominos','sqlreference':{'keyVault':'dominos-urbumyyogx-kv','fdqn':'venio-dominos-sql.eastus.cloudapp.azure.com'}},{'clientname':'boeing','sqlreference':{'keyVault':'boeing-c4uujz4qkc-kv','fdqn':'venio-dominos-sql.eastus.cloudapp.azure.com'}}]}

which you can see is missing ^\" characters

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,120 questions
{count} votes