In an Azure devops pipeline, I am trying to execute a powershell script from a file.
- task: AzurePowerShell@5
displayName: 'AzurePowershell script'
inputs:
azureSubscription: 'MyServiceConnection'
ScriptType: FilePath
ScriptPath: '$(System.DefaultWorkingDirectory)/path-to-script.ps1'
ScriptArguments: -firstParam "test"
azurePowerShellVersion: LatestVersion
The issue is that I keep getting the following error:
Missing argument in parameter list.
At D:\a\_temp\a05fb35e-757c-4a3a-8729-*******.ps1:48 char:60
+ . 'D:\a\1\s\path-to-script.ps1' -firstParam "test"
+ ~
The string is missing the terminator: ".
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : MissingArgument
I simplified my script to the point of having only a Write-Host inside to be sure it did not come from it, but at the end the goal is to use the pre-deployment script provided by microsoft for Azure data factories here.
param
(
[parameter(Mandatory = $false)] [String] $firstParam
)
Write-Host $firstParam
I also tried using a PowerShell@2 and AzurePowerShell@4 tasks instead of the AzurePowerShell@5 and there it worked. So the problem seems to be only when using AzurePowerShell@5.
Do you have an idea of what I am doing wrong ?