az iot central device command

Run device commands.

Commands

az iot central device command history

Get most recent command-response request and response payload.

az iot central device command run

Run a command on a device and view associated response. Does NOT monitor property updates that the command may perform.

az iot central device command history

Get most recent command-response request and response payload.

az iot central device command history --app-id
                                      --cn
                                      --device-id
                                      --interface-id
                                      [--central-api-uri]
                                      [--token]

Examples

Show command response

az iot central device command history --app-id {appid} --device-id {deviceid} --interface-id {interfaceid} --command-name {commandname}

Required Parameters

--app-id -n

Target App.

--cn --command-name

Command name as specified in device template. Example: run_firmware_update.

--device-id -d

Target Device.

--interface-id -i

Interface name as specified in the device template. Example: c2dTestingTemplate_356.

Optional Parameters

--central-api-uri --central-dns-suffix

Central dns suffix. This enables running cli commands against non public/prod environments.

default value: azureiotcentral.com
--token

Authorization token for request. More info available here: https://docs.microsoft.com/en-us/learn/modules/manage-iot-central-apps-with-rest-api/ MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...'). Example: 'Bearer someBearerTokenHere'.

az iot central device command run

Run a command on a device and view associated response. Does NOT monitor property updates that the command may perform.

Note: payload should be nested under "request". i.e. if your device expects the payload in a shape {"key": "value"} payload should be {"request": {"key": "value"}}. --content can be pointed at a filepath too (.../path/to/payload.json).

az iot central device command run --app-id
                                  --cn
                                  --content
                                  --device-id
                                  --interface-id
                                  [--central-api-uri]
                                  [--token]

Examples

Run command response

az iot central device command run --app-id {appid} --device-id {deviceid} --interface-id {interfaceid} --command-name {commandname} --content {payload}

Short Run command response

az iot central device command run -n {appid} -d {deviceid} -i {interfaceid} --cn {commandname} -k {payload}

Required Parameters

--app-id -n

Target App.

--cn --command-name

Command name as specified in device template. Example: run_firmware_update.

--content -k

Configuration for request. Provide path to JSON file or raw stringified JSON. [File Path Example: ./path/to/file.json] [Stringified JSON Example: {'a': 'b'}].

--device-id -d

Target Device.

--interface-id -i

Interface name as specified in the device template. Example: c2dTestingTemplate_356.

Optional Parameters

--central-api-uri --central-dns-suffix

Central dns suffix. This enables running cli commands against non public/prod environments.

default value: azureiotcentral.com
--token

Authorization token for request. More info available here: https://docs.microsoft.com/en-us/learn/modules/manage-iot-central-apps-with-rest-api/ MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...'). Example: 'Bearer someBearerTokenHere'.