Skip to content
Latchkey

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.

Azure DevOps
##[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.

azure-pipelines.yml
steps:
  - task: AzureCLI@2
    inputs:
      azureSubscription: 'azure-prod'
      scriptType: bash            # bash | pscore | ps | batch
      scriptLocation: inlineScript
      inlineScript: |
        az account show

Run a script file with scriptPath

When the logic lives in a file, set scriptLocation: scriptPath and scriptPath.

azure-pipelines.yml
  - task: AzureCLI@2
    inputs:
      azureSubscription: 'azure-prod'
      scriptType: pscore
      scriptLocation: scriptPath
      scriptPath: scripts/deploy.ps1

How to prevent it

  • Pick a scriptType supported on the target agent OS (bash/pscore cross-platform).
  • Match scriptLocation to either inlineScript or scriptPath.
  • Use the editor’s task assistant to fill AzureCLI@2 inputs correctly.

Frequently asked questions

What causes ""scriptType is not valid""?
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.
How do I fix "scriptType is not valid"?
Pair scriptType/scriptLocation with the correct script input for the agent OS.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card