Share via


az dt twin component

Note

This reference is part of the azure-iot extension for the Azure CLI (version 2.46.0 or higher). The extension will automatically install the first time you run an az dt twin component command. Learn more about extensions.

Show and update the digital twin components of a Digital Twins instance.

Commands

Name Description Type Status
az dt twin component show

Show details of a digital twin component.

Extension GA
az dt twin component update

Update a digital twin component via JSON patch specification.

Extension GA

az dt twin component show

Show details of a digital twin component.

az dt twin component show --component
                          --dt-name
                          --twin-id
                          [--resource-group]

Examples

Show details of a digital twin component

az dt twin component show -n {instance_or_hostname} --twin-id {twin_id} --component Thermostat

Required Parameters

--component

The path to the DTDL component.

--dt-name --dtn -n

Digital Twins instance name or hostname. If an instance name is provided, the user subscription is first queried for the target instance to retrieve the hostname. If a hostname is provided, the subscription query is skipped and the provided value is used for subsequent interaction.

--twin-id -t

The digital twin Id.

Optional Parameters

--resource-group -g

Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az dt twin component update

Update a digital twin component via JSON patch specification.

Updates to property values and $model elements may happen in the same request. Operations are limited to add, replace and remove.

az dt twin component update --component
                            --dt-name
                            --json-patch
                            --twin-id
                            [--etag]
                            [--resource-group]

Examples

Update a digital twin component via JSON patch specification.

az dt twin component update -n {instance_or_hostname} --twin-id {twin_id} --component {component_path} --json-patch '{"op":"replace", "path":"/Temperature", "value": 20.5}'

Update a digital twin component via JSON patch specification.

az dt twin component update -n {instance_or_hostname} --twin-id {twin_id} --component {component_path} --json-patch '[
  {"op":"replace", "path":"/Temperature", "value": 20.5},
  {"op":"add", "path":"/Areas", "value": ["ControlSystem"]}
]'

Update a digital twin component via JSON patch specification defined in a file.

az dt twin component update -n {instance_or_hostname} --twin-id {twin_id} --component {component_path} --json-patch ./my/patch/document.json

Required Parameters

--component

The path to the DTDL component.

--dt-name --dtn -n

Digital Twins instance name or hostname. If an instance name is provided, the user subscription is first queried for the target instance to retrieve the hostname. If a hostname is provided, the subscription query is skipped and the provided value is used for subsequent interaction.

--json-patch --patch

An update specification described by JSON-patch. Updates to property values and $model elements may happen in the same request. Operations are limited to add, replace and remove. Provide file path or inline JSON.

--twin-id -t

The digital twin Id.

Optional Parameters

--etag -e

Entity tag value. The command will succeed if the etag matches the current etag for the resource.

--resource-group -g

Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.