Hi Rupali Bhore
Azure DevOps currently does not natively support auto-rejecting or canceling a run if an approval is not granted, it simply skips the environment after the timeout.
To force a cancellation or rejection if approval isn’t granted within the timeout window, you’ll need to use the ManualValidation@0 task inside an agentless job.
jobs:
- job: waitForApproval
displayName: 'Wait for manual approval'
pool: server # agentless job
timeoutInMinutes: 43200 # 30 days
steps:
- task: ManualValidation@0
inputs:
instructions: 'Please approve the deployment.'
notifyUsers: |
[email protected]
onTimeout: 'reject' # This will cancel the pipeline if approval isn't given
timeoutInMinutes: 43200 # 30 days
Then, make your actual deployment job depend on this approval job:
- deployment: Deploy_${{ parameters.functionAppName }}
dependsOn: waitForApproval
environment: ${{ parameters.longName }}
strategy:
runOnce:
deploy:
steps:
- script: echo "Deploying..."
The ManualValidation@0 task pauses the pipeline and waits for approval. If approval isn’t granted within the timeout, it explicitly rejects the run.
Hope this helps!
Please Let me know if you have any queries.