Azure Pipelines Deployment Stuck "Waiting for approval"
A deployment job targets an environment that has an approval or check configured, so the run pauses (or is blocked) until an approver signs off. It can also fail outright if the pipeline is not permitted to use the environment.
What this error means
A deployment: job stops at Waiting for approval and never proceeds, or fails with a message that the pipeline is not authorized to use the environment. The build stages complete but the deploy stage stalls.
This run is waiting for approval before it can deploy to environment
'production'.
##[error]Pipeline does not have permission to use environment 'production'.Common causes
A required approval or check is pending
The target environment has an Approvals and checks policy. The deploy job blocks until a designated approver approves it - this is intentional governance, not a failure.
Environment not authorized for the pipeline
Like service connections and variable groups, an environment is a protected resource. A pipeline must be authorized to use it before the deploy job can run.
How to fix it
Approve the run or authorize the pipeline
- For a pending approval, an approver opens the run and approves the environment check.
- For an authorization error, open Pipelines → Environments → the environment → Security/Pipeline permissions and add this pipeline.
- Re-run; the first deploy to a new environment often shows an authorization prompt to approve.
Reference the environment correctly
Use a deployment: job with the exact environment name configured in Environments.
jobs:
- deployment: deploy
environment: production # exact name from Pipelines → Environments
strategy:
runOnce:
deploy:
steps:
- script: echo deployingHow to prevent it
- Authorize environments per pipeline when first wiring a deploy.
- Document who can approve each environment so runs are not stuck unattended.
- Keep environment names stable and matching across pipelines.