Skip to content
Latchkey

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 DevOps
/azure-pipelines.yml (Line: 14, Col: 7): Unexpected value 'steps'
# rolling/canary require resources (VMs) in the environment

Common 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.

azure-pipelines.yml
jobs:
  - deployment: deployWeb
    environment: production
    strategy:
      runOnce:
        deploy:
          steps:
            - script: ./deploy.sh

Use rolling/canary only with VM resources

For rolling, target an environment with VM resources and set maxParallel.

azure-pipelines.yml
strategy:
  rolling:
    maxParallel: 2
    deploy:
      steps:
        - script: ./deploy.sh

How 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.

Frequently asked questions

What causes ""Unexpected value" in strategy"?
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.
How do I fix "Unexpected value" in strategy?
Use the strategy + hook shape for the deployment job.

Related guides

References

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