Azure / Azure/azure-cli

First "az vm run-command invoke" returns successful, automation kicks off second "az vm run-command invoke" returns failure.

Open
#19,137 1 comment 4 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-observability-squad Compute feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 22h
Merged PRs (30d)
64

Description

> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62

**Describe the bug**
In our automation, we are using az vm run-comand invoke multiple times to check if VMs are up and ready.
For this current case we use it to run cloud-init status --wait.
That returns successful, have a grep for checking. Then a second command is kicked off in automation,
this one is tailing our loud-init-output.log file, to make sure everything is set up correctly. Sometimes this command is failing with the following error:

**ERROR: (Conflict) Run command extension execution is in progress. Please wait for completion before invoking a run command.**

I have also seen it fail later on in our automation, with the same error.
We are hitting it more often and I have been able to hit it manually as well.

**To Reproduce**
```
az vm create (with custom data file - cloud-init file)
az vm run-command invoke \
--resource-group ${RESOURCE_GROUP_NAME} \
--name ${VM_NAME} \
--command-id RunShellScript \
--scripts "cloud-init status --wait" \
--query 'value[0].message' --output tsv | tee ${cmdlog}

az vm run-command invoke \
--command-id RunShellScript \
--name ${VM_NAME} \
--resource-group ${RESOURCE_GROUP_NAME} \
--scripts "tail -100 /var/log/cloud-init-output.log" \
--query 'value[0].message' --output tsv | tee /tmp/cloud-init_output.log

```
**Expected behavior**
az vm run-command invoke should not think another run-command is running if the previous command returned successful.

**Environment summary**
Pipelines Run on Azure Devops:

Agent name: 'Azure Pipelines 2'
Agent machine name: 'fv-az234-671'
Current agent version: '2.189.0'
Operating System
Ubuntu
20.04.2
LTS
Virtual Environment
Environment: ubuntu-20.04

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.