Reputation: 3283
I get this error when using azure cli with multiple lines. Single commands are working fine.
The term 'call' is not recognized as the name of a cmdlet, function, script file, or operable program. Check...
Upvotes: 0
Views: 279
Reputation: 1424
I've just created a new release and replicated the behavior. You actually have Powershell
selected in the Script Type
field. Change it to Batch
and it will work as expected.
EDIT
I thought I'd also share how to run Batch scripts from your repo and not worry if the dev has a call
statement at the start of each line. I simply have a standardise script in my build which injects call
before publishing the artifact
$Deploy_File = Get-Item "Azure-Commands.cmd"
$Deploy_File_Script = $Deploy_File | Get-Content
$Deploy_File_Script_Mod = @()
##Standardise commands for Azure CLI Deployment task
# Loop through Commands
foreach ($Command in $Deploy_File_Script) {
#Insert "CALL" before each azure command
if ($Command -like "az *") {
$Command = "call " + $Command
}
# Build Modified script array
$Deploy_File_Script_Mod += "$Command"
}
#Save to file
$Deploy_File | Set-Content -Value $Deploy_File_Script_Mod
#Output modified commands in file
$Deploy_File | Get-Content
Now you can just call the standardised deploy file from the task above
Upvotes: 2