I'm getting the following error while trying to use the Azure CLI task in my DevOps YAML pipeline:
"An error occurred while loading the YAML build pipeline. wrong number of segments"
I'm following this documentation, running on a self-hosted Windows agent with Azure CLI and PowerShell Core installed.
- task: AzureCLI@2
displayName: Azure CLI
inputs:
azureSubscription: MyServiceName
scriptType: pscore
scriptLocation: inlineScript
inlineScript: az --version
UPDATED: There are no other tasks in the file and it is valid. As an experiment I changed the task to AzureCLI@1
and it worked (v1 does not include Script Type):
- task: AzureCLI@1
displayName: Azure CLI
inputs:
azureSubscription: MyServiceName
scriptLocation: inlineScript
inlineScript: az --version