az iot pnp twin
Manipulate and interact with the digital twin of an IoT Hub device.
Commands
az iot pnp twin invoke-command |
Invoke a root or component level command of a digital twin device. |
az iot pnp twin show |
Show the digital twin of an IoT Hub device. |
az iot pnp twin update |
Update the read-write properties of a digital twin device via JSON patch specification. |
az iot pnp twin invoke-command
Invoke a root or component level command of a digital twin device.
az iot pnp twin invoke-command --cn
--device-id
[--component-path]
[--hub-name]
[--login]
[--payload]
[--resource-group]
[--timeout]
Examples
Invoke root level command "reboot" which takes a payload that includes the "delay" property.
az iot pnp twin invoke-command --command-name reboot -n {iothub_name} -d {device_id} --payload '{"delay":5}'
Invoke command "getMaxMinReport" on component "thermostat1" that takes no input.
az iot pnp twin invoke-command --cn getMaxMinReport -n {iothub_name} -d {device_id} --component-path thermostat1
Required Parameters
Digital twin command name.
Target Device.
Optional Parameters
Digital twin component path. For example: thermostat1.
IoT Hub name.
This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.
JSON payload input for command. Provide file path or inline JSON.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Maximum number of seconds to wait for device method result.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az iot pnp twin show
Show the digital twin of an IoT Hub device.
az iot pnp twin show --device-id
[--hub-name]
[--login]
[--resource-group]
Examples
Show the target device digital twin.
az iot pnp twin show -n {iothub_name} -d {device_id}
Required Parameters
Target Device.
Optional Parameters
IoT Hub name.
This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az iot pnp twin update
Update the read-write properties of a digital twin device via JSON patch specification.
Currently operations are limited to add, replace and remove.
az iot pnp twin update --device-id
--json-patch
[--hub-name]
[--login]
[--resource-group]
Examples
Update a digital twin via JSON patch specification.
az iot pnp twin update --hub-name {iothub_name} --device-id {device_id} --json-patch '{"op":"add", "path":"/thermostat1/targetTemperature", "value": 54}'
Update a digital twin via JSON patch specification.
az iot pnp twin update -n {iothub_name} -d {device_id} --json-patch '[
{"op":"remove", "path":"/thermostat1/targetTemperature"},
{"op":"add", "path":"/thermostat2/targetTemperature", "value": 22}
]'
Update a digital twin property via JSON patch specification defined in a file.
az iot pnp twin update -n {iothub_name} -d {device_id} --json-patch ./my/patch/document.json
Required Parameters
Target Device.
An update specification described by JSON-patch. Operations are limited to add, replace and remove. Provide file path or inline JSON.
Optional Parameters
IoT Hub name.
This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.