Azure Pipelines AzureCLI@2 "scriptType" / "scriptLocation" Invalid
The AzureCLI@2 task requires a valid scriptType (bash, pscore, ps, or batch), a scriptLocation (inlineScript or scriptPath), and the matching script input. A wrong combination - or a scriptType not available on the agent OS - fails the task.
What this error means
The task fails at validation or start with an invalid scriptType/scriptLocation, or because inlineScript was empty while scriptLocation: inlineScript. The Azure CLI never runs.
##[error]Input required: inlineScript
##[error]Unsupported scriptType 'powershell'. Use bash, pscore, ps, or batch.Common causes
Invalid or OS-incompatible scriptType
Only bash, pscore, ps, batch are valid. ps/batch are Windows-only; bash/pscore are cross-platform. A wrong value, or ps on Linux, fails.
scriptLocation and script input mismatch
scriptLocation: inlineScript requires inlineScript; scriptLocation: scriptPath requires scriptPath. Providing the wrong one (or neither) is rejected.
How to fix it
Use a valid scriptType with the matching input
Pair scriptType/scriptLocation with the correct script input for the agent OS.
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'azure-prod'
scriptType: bash # bash | pscore | ps | batch
scriptLocation: inlineScript
inlineScript: |
az account showRun a script file with scriptPath
When the logic lives in a file, set scriptLocation: scriptPath and scriptPath.
- task: AzureCLI@2
inputs:
azureSubscription: 'azure-prod'
scriptType: pscore
scriptLocation: scriptPath
scriptPath: scripts/deploy.ps1How to prevent it
- Pick a
scriptTypesupported on the target agent OS (bash/pscorecross-platform). - Match
scriptLocationto eitherinlineScriptorscriptPath. - Use the editor’s task assistant to fill AzureCLI@2 inputs correctly.