Azure Pipelines Environment Check Failed (gate/approval/Invoke)
An environment’s Approvals and checks include automated checks (Invoke REST API, Azure Monitor, exclusive lock, required template). When one fails or times out, the deployment job to that environment is blocked - distinct from a simple pending manual approval.
What this error means
A deployment: job fails or stays blocked with a message that an environment check did not pass - a gate returned non-success, a monitor alert was firing, or an exclusive lock held the environment for another run.
##[error]Check 'Invoke REST API' for environment 'production' failed:
expected status 200, received 503.Common causes
Automated gate returned a failing result
An Invoke REST API or Azure Monitor check evaluates an external signal. A non-success response (or a firing alert) fails the check and blocks the deploy.
Exclusive lock or required-template check
An exclusive-lock check serializes deploys to an environment; a concurrent run holds the lock. A required-template check fails if the pipeline does not extend the mandated template.
How to fix it
Inspect and resolve the failing check
- Open the run’s environment check details to see which check failed and why.
- For an Invoke REST API gate, fix the endpoint/health it polls (or its success criteria).
- For an exclusive lock, wait for the holding run to finish or cancel it; for required-template, extend the mandated template.
Reference the environment in a deployment job
Checks bind to the environment, so the job must be a deployment: targeting it by name.
jobs:
- deployment: deploy
environment: production
strategy:
runOnce:
deploy:
steps: [ { script: ./deploy.sh } ]How to prevent it
- Make gate health endpoints reliable so checks do not flap.
- Use exclusive locks deliberately to serialize environment deploys.
- Keep required-template checks aligned with the pipelines that deploy.