Azure / Azure/azure-cli

Support exit code reporting in az run-command invoke

Open
#25,948 2 comments 4 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-observability-squad Azure CLI Team Compute question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**

`az vm run-command invoke` is a bit weird, because it reports the provisioning state of the run command deployment. `--output tsv` shows `1` aka Deployment succeeded.

**Is your feature request related to a problem? Please describe.**

Currently, there is no way to remotely do a command like a `ping` test, and validate that the ping went through, except if you parse stdout/stderr. And those bits have to be parsed from the output message, so that makes it even more tedious.

**Describe the solution you'd like**

The output json/tsv should contain an exit code value as well.

**Describe alternatives you've considered**

I am not sure, there are many implementation unknowns on my end for the client.

**Additional context**

I'm trying to build a tool that does end-point connectivity between running VMs (to ensure our network is set up correctly). The problem is that I have no way to validate that a remotely executed ping worked without parsing the output which looks a little something like this:

```json
{
"value": [
{
"code": "ProvisioningState/succeeded",
"displayStatus": "Provisioning succeeded",
"level": "Info",
"message": "Enable succeeded: \n[stdout]\nPING 192.168.10.10 (192.168.10.10) 56(84) bytes of data.\n\n--- 192.168.10.10 ping statistics ---\n5 packets transmitted, 0 received, 100% packet loss, time 4078ms\n\n\n[stderr]\n",
"time": null
}
]
}
```

Or, if output is `tsv`:
`1`

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.