az iot hub device-twin
Manage IoT device twin configuration.
Commands
az iot hub device-twin replace |
Replace device twin definition with target json. |
az iot hub device-twin show |
Get a device twin definition. |
az iot hub device-twin update |
Update device twin desired properties and tags. |
az iot hub device-twin replace
Replace device twin definition with target json.
Input json directly or use a file path.
az iot hub device-twin replace --device-id
--json
[--hub-name]
[--login]
[--resource-group]
Examples
Replace device twin with file contents.
az iot hub device-twin replace -d {device_id} -n {iothub_name} -j ../mydevicetwin.json
Required Parameters
Target Device.
Json to replace existing twin with. Provide file path or raw 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.
az iot hub device-twin show
Get a device twin definition.
az iot hub device-twin show --device-id
[--hub-name]
[--login]
[--resource-group]
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 hub device-twin update
Update device twin desired properties and tags.
Provide --desired or --tags arguments for PATCH behavior. Usage of generic update args (i.e. --set) will reflect PUT behavior and are deprecated.
az iot hub device-twin update --device-id
[--add]
[--desired]
[--force-string]
[--hub-name]
[--login]
[--remove]
[--resource-group]
[--set]
[--tags]
Examples
Patch device twin desired properties.
az iot hub device-twin update -n {iothub_name} -d {device_id} --desired '{"conditions":{"temperature":{"warning":70, "critical":100}}}'
Patch device twin tags.
az iot hub device-twin update -n {iothub_name} -d {device_id} --tags '{"country": "USA"}'
Patch removal of 'critical' desired property from parent 'temperature'
az iot hub device-twin update -n {iothub_name} -d {device_id} --desired '{"condition":{"temperature":{"critical": null}}}'
Required Parameters
Target Device.
Optional Parameters
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.
Twin desired properties.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
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.
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Update an object by specifying a property path and value to set. Example: --set property1.property2=.
Twin tags.
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.