1

I am getting below error while executing the Azure VM extension in Terraform for run Powershell script. Could you please help me to solve this error?

Command execution finished, but failed because it returned a non-zero exit code of: '1'. The command had an error output of: 'The command line is too long. '

Here is the protected settings details which is I used

"commandToExecute": "powershell -command \"[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${base64encode(data.template_file.secvmtf.rendered)}')) | Out-File -filepath hybrid.ps1\" && powershell -ExecutionPolicy Unrestricted -File hybrid.ps1"
jps
  • 20,041
  • 15
  • 75
  • 79
Siva Raj
  • 11
  • 1

1 Answers1

0

According to this document the script parameter data can't exceed the size of 256Kb, otherwise it will not be executed.

The script must be base64 encoded. The script can optionally be gzip'ed. The script setting can be used in public or protected settings. The maximum size of the script parameter's data is 256 KB. If the script exceeds this size it will not be executed.

https://github.com/Azure/custom-script-extension-linux/blob/master/README.md#14-script

dutompson
  • 36
  • 4