az dt twin

Manage and configure the digital twins of a Digital Twins instance.

Commands

az dt twin component

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

az dt twin component show

Show details of a digital twin component.

az dt twin component update

Update a digital twin component via JSON patch specification.

az dt twin create

Create a digital twin on an instance.

az dt twin delete

Remove a digital twin. All relationships referencing this twin must already be deleted.

az dt twin query

Query the digital twins of an instance. Allows traversing relationships and filtering by property values.

az dt twin relationship

Manage and configure the digital twin relationships of a Digital Twins instance.

az dt twin relationship create

Create a relationship between source and target digital twins.

az dt twin relationship delete

Delete a digital twin relationship on a Digital Twins instance.

az dt twin relationship list

List the relationships of a digital twin.

az dt twin relationship show

Show details of a digital twin relationship.

az dt twin relationship update

Updates the properties of a relationship between two digital twins via JSON patch specification.

az dt twin show

Show the details of a digital twin.

az dt twin telemetry

Test and validate the event routes and endpoints of a Digital Twins instance.

az dt twin telemetry send

Sends telemetry on behalf of a digital twin. If component path is provided the emitted telemetry is on behalf of the component.

az dt twin update

Update an instance digital twin via JSON patch specification.

az dt twin create

Create a digital twin on an instance.

--properties can be inline JSON or file path.

az dt twin create --dt-name
                  --dtmi
                  --twin-id
                  [--properties]
                  [--resource-group]

Examples

Create a digital twin from an existing (prior-created) model.

az dt twin create -n {instance_or_hostname} --dtmi dtmi:example:Room;1 --twin-id {twin_id}

Create a digital twin from an existing (prior-created) model. Instantiate with property values.

az dt twin create -n {instance_or_hostname} --dtmi dtmi:com:example:DeviceInformation;1 --twin-id {twin_id} --properties '{"manufacturer": "Microsoft"}'

Create a digital twin with component from existing (prior-created) models. Instantiate with property values.

az dt twin create -n {instance_or_hostname} --dtmi dtmi:com:example:TemperatureController;1 --twin-id {twin_id} --properties '{
    "Temperature": 10.2,
    "Thermostat": {
        "$metadata": {},
        "setPointTemp": 23.12
    }
}'

Required Parameters

--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.

--dtmi --model-id -m

Digital Twins model Id. Example: dtmi:example:Room;2.

--twin-id -t

The digital twin Id.

Optional Parameters

--properties -p

Initial property values for instantiating a digital twin or related components. Provide file path or inline JSON.

--resource-group -g

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

az dt twin delete

Remove a digital twin. All relationships referencing this twin must already be deleted.

az dt twin delete --dt-name
                  --twin-id
                  [--resource-group]

Examples

Remove a digital twin by Id.

az dt twin delete -n {instance_or_hostname} --twin-id {twin_id}

Required Parameters

--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>.

az dt twin query

Query the digital twins of an instance. Allows traversing relationships and filtering by property values.

az dt twin query --dt-name
                 --query-command
                 [--cost {false, true}]
                 [--resource-group]

Examples

Query all digital twins in target instance and project all attributes. Also show cost in query units.

az dt twin query -n {instance_or_hostname} -q "select * from digitaltwins" --show-cost

Query by model and project all attributes.

az dt twin query -n {instance_or_hostname} -q "select * from digitaltwins T where IS_OF_MODEL(T, 'dtmi:example:Room;2')"

Required Parameters

--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.

--query-command -q

User query to be executed.

Optional Parameters

--cost --show-cost

Calculates and shows the query charge.

accepted values: false, true
--resource-group -g

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

az dt twin show

Show the details of a digital twin.

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

Examples

Show the details of a digital twin.

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

Required Parameters

--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>.

az dt twin update

Update an instance digital twin 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 update --dt-name
                  --json-patch
                  --twin-id
                  [--resource-group]

Examples

Update a digital twin via JSON patch specification.

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

Update a digital twin via JSON patch specification.

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

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

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

Required Parameters

--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

--resource-group -g

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