Troubleshooting Azure DevOps deployment stuck at 'Queued' status

Dec 12, 2020 | Utkarsh Shigihalli Utkarsh Shigihalli | 1 min read

Azure Pipelines Azure DevOps


Recently one of our customer was trying to deploy to an VM environment using Azure DevOps and all of their deployments were getting stuck at Queued status. To their surprise, they had idle Azure DevOps agents to work on the jobs. After scratching head for couple of hours, the fix was not what I had expected…

The YAML pipeline was as below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
stages:
 - stage: CD
   jobs:
      - deployment: deploy
        displayName: deploy app
        environment: 
          name: 'rdv'
          resourceType: VirtualMachine
          tags: rdv
        strategy:
          runOnce:
            deploy:
              steps:
                - tasks: ...

Nothing suspicious here. Notice, we are targeting specific VM resource with tag rdv here.

Assuming something wrong with the machine, we re-registered the agent and also recreated the environment. Still the same issue!!

After struggling to find an answer, I also posted a question in Developer Community asking for help.

Cause

Well, the cause was not what I had expected - there wasn’t anything wrong with the configuration of VM.

Take a look at line #4 in the above YAML. Apparently name deploy is a reserved name for deployment job and having that name Deploy for deployment causes pipeline to hang. Surprisingly its not mentioned anywhere in the documentation as well!

So after renaming the deployment to something different as below (notice line #4), deployment started working again!

1
2
3
4
5
6
7
8
9
10
11
stages:
 - stage: CD
   jobs:
      - deployment: deploy_rdv
        displayName: deploy app
        environment: 
          name: 'rdv'
          resourceType: VirtualMachine
          tags: rdv
        strategy:
          ...

That’s it, simple one - but definitely saves you half a day if you ever gets stuck with the same issue. Make sure you name your deployment name to something other than deploy 🤕 😅


About author
Utkarsh Shigihalli
Utkarsh Shigihalli
Utkarsh is passionate about software development and has experience in the areas of Azure, Azure DevOps, C# and TypeScript. Over the years he has worked as an architect, independent consultant and manager in many countries including India, United States, Netherlands and United Kingdom. He is a Microsoft MVP and has developed numerous extensions for Visual Studio and Azure DevOps.