Azure Pipelines Deployment Strategy Invalid (runOnce/rolling/canary)
A deployment: job must declare a strategy (runOnce, rolling, or canary) with lifecycle hooks under it - it cannot take a bare steps: list. A misspelled strategy or one unsupported by the environment fails to compile.
What this error means
The pipeline rejects the deployment job with Unexpected value 'steps' (steps placed directly under deployment) or Unexpected value 'rolling' when the strategy or hook is malformed. The deploy job never runs.
/azure-pipelines.yml (Line: 14, Col: 7): Unexpected value 'steps'
# rolling/canary require resources (VMs) in the environmentCommon causes
steps placed directly under deployment
Unlike a regular job, a deployment: job nests its steps inside strategy.runOnce.deploy.steps (or the rolling/canary equivalent). A top-level steps: is invalid.
rolling/canary on an unsupported environment
rolling and canary strategies require the environment to contain resources (e.g. VM resources). On an empty/logical environment only runOnce is valid.
How to fix it
Wrap steps in a runOnce deploy hook
Use the strategy + hook shape for the deployment job.
jobs:
- deployment: deployWeb
environment: production
strategy:
runOnce:
deploy:
steps:
- script: ./deploy.shUse rolling/canary only with VM resources
For rolling, target an environment with VM resources and set maxParallel.
strategy:
rolling:
maxParallel: 2
deploy:
steps:
- script: ./deploy.shHow to prevent it
- Remember deployment jobs nest steps under a strategy hook.
- Match the strategy to the environment’s resource type.
- Validate the pipeline after converting a job to a deployment job.