Skip to content

Commit 9721652

Browse files
Update BMM run-read-command examples to conform to Azure CLI Shorthand format
Replace single quoted strings with double quoted strings to fix 'Failed to parse' azure CLI errors on Windows (cmd). Add additional examples and explanation for the --commands parameter.
1 parent df75196 commit 9721652

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

articles/operator-nexus/howto-baremetal-run-read.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: eak13
55
ms.author: ekarandjeff
66
ms.service: azure-operator-nexus
77
ms.topic: how-to
8-
ms.date: 1/17/2025
8+
ms.date: 1/31/2025
99
ms.custom: template-how-to
1010
---
1111

@@ -159,7 +159,7 @@ The run-read command lets you run a command on the BMM that doesn't change anyth
159159
than one word, or need an argument to work. These commands are made like this to separate them from the ones
160160
that can change things. For example, run-read-command can use `kubectl get` but not `kubectl apply`. When you
161161
use these commands, you have to put all the words in the "command" field. For example,
162-
`{"command":"kubectl get","arguments":["nodes"]}` is right; `{"command":"kubectl","arguments":["get","nodes"]}`
162+
`{command:'kubectl get',arguments:[nodes]}` is right; `{command:'kubectl',arguments:[get,nodes]}`
163163
is wrong.
164164

165165
Also note that some commands begin with `nc-toolbox nc-toolbox-runread` and must be entered as shown.
@@ -339,19 +339,26 @@ This list shows the commands you can use. Commands in `*italics*` can't have `ar
339339
- `nc-toolbox nc-toolbox-runread mstfwmanager` (requires `query` arg)
340340
- `nc-toolbox nc-toolbox-runread mlx_temp`
341341

342-
The command syntax is:
342+
The command syntax for a single command with no arguments is as follows, using `hostname` as an example:
343343

344344
```azurecli
345345
az networkcloud baremetalmachine run-read-command --name "<machine-name>"
346346
--limit-time-seconds "<timeout>" \
347-
--commands '[{"command":"<command1>"},{"command":"<command2>","arguments":["<arg1>","<arg2>"]}]' \
347+
--commands "[{command:hostname}]" \
348348
--resource-group "<cluster_MRG>" \
349349
--subscription "<subscription>"
350350
```
351351

352-
Multiple commands can be provided in json format to `--commands` option.
352+
- The `--commands` parameter always takes a list of commands, even if there's only one command.
353+
- Multiple commands can be provided in json format using [Azure CLI Shorthand](https://aka.ms/cli-shorthand) notation.
354+
- Any whitespace must be enclosed in single quotes.
355+
- Any arguments for each command must also be provided as a list, as shown in the following examples.
353356

354-
For a command with multiple arguments, provide as a list to `arguments` parameter. See [Azure CLI Shorthand](https://github.com/Azure/azure-cli/blob/dev/doc/shorthand_syntax.md) for instructions on constructing the `--commands` structure.
357+
```
358+
--commands "[{command:hostname},{command:'nc-toolbox nc-toolbox-runread racadm ifconfig'}]"
359+
--commands "[{command:hostname},{command:'nc-toolbox nc-toolbox-runread racadm getsysinfo',arguments:[-c]}]"
360+
--commands "[{command:ping,arguments:[198.51.102.1,-c,3]}]"
361+
```
355362

356363
These commands can be long running so the recommendation is to set `--limit-time-seconds` to at least 600 seconds (10 minutes). Running multiple commands might take longer than 10 minutes.
357364

@@ -377,7 +384,7 @@ az networkcloud baremetalmachine run-read-command --name "<bareMetalMachineName>
377384
```azurecli
378385
az networkcloud baremetalmachine run-read-command --name "<bareMetalMachineName>" \
379386
--limit-time-seconds 60 \
380-
--commands '[{"command":"hostname"},{"command":"ping","arguments":["198.51.102.1","-c","3"]}]' \
387+
--commands "[{command:hostname},{command:ping,arguments:[198.51.102.1,-c,3]}]" \
381388
--resource-group "<cluster_MRG>" \
382389
--subscription "<subscription>"
383390
```
@@ -387,7 +394,7 @@ az networkcloud baremetalmachine run-read-command --name "<bareMetalMachineName>
387394
```azurecli
388395
az networkcloud baremetalmachine run-read-command --name "<bareMetalMachineName>" \
389396
--limit-time-seconds 60 \
390-
--commands '[{"command":"nc-toolbox nc-toolbox-runread racadm getsysinfo","arguments":["-c"]}]' \
397+
--commands "[{command:'nc-toolbox nc-toolbox-runread racadm getsysinfo',arguments:[-c]}]" \
391398
--resource-group "<cluster_MRG>" \
392399
--subscription "<subscription>"
393400
```

0 commit comments

Comments
 (0)