az dt twin relationship

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

Commands

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

Create a relationship between source and target digital twins.

--properties can be inline JSON or file path.

az dt twin relationship create --dt-name
                               --kind
                               --relationship-id
                               --source
                               --target
                               [--properties]
                               [--resource-group]

Examples

Create a relationship between two digital twins.

az dt twin relationship create -n {instance_or_hostname} --relationship-id {relationship_id} --relationship contains --twin-id {source_twin_id} --target {target_twin_id}

Create a relationship with initialized properties between two digital twins.

az dt twin relationship create -n {instance_or_hostname} --relationship-id {relationship_id} --relationship contains --twin-id {source_twin_id} --target {target_twin_id} --properties '{"ownershipUser": "me", "ownershipDepartment": "Computer Science"}'

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.

--kind --relationship

Relationship name or kind. For example: 'contains'.

--relationship-id -r

Relationship Id.

--source --twin-id -t

The source twin Id for a relationship.

--target --target-twin-id

The target twin Id for a relationship.

Optional Parameters

--properties -p

Initial property values for instantiating a digital twin relationship. 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 relationship delete

Delete a digital twin relationship on a Digital Twins instance.

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

Examples

Delete a digital twin relationship.

az dt twin relationship delete -n {instance_or_hostname} --twin-id {twin_id} --relationship-id {relationship_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.

--relationship-id -r

Relationship Id.

--source --twin-id -t

The source twin Id for a relationship.

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

List the relationships of a digital twin.

az dt twin relationship list --dt-name
                             --source
                             [--incoming {false, true}]
                             [--kind]
                             [--resource-group]

Examples

List outgoing relationships of a digital twin.

az dt twin relationship list -n {instance_or_hostname} --twin-id {twin_id}

List outgoing relationships of a digital twin and filter on relationship 'contains'

az dt twin relationship list -n {instance_or_hostname} --twin-id {twin_id} --relationship contains

List incoming relationships of a digital twin.

az dt twin relationship list -n {instance_or_hostname} --twin-id {twin_id} --incoming

List incoming relationships of a digital twin and filter on relationship 'contains'.

az dt twin relationship list -n {instance_or_hostname} --twin-id {twin_id} --relationship contains --incoming

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.

--source --twin-id -t

The source twin Id for a relationship.

Optional Parameters

--incoming

Retrieves all incoming relationships for a digital twin.

accepted values: false, true
--kind --relationship

Filter result by the kind of relationship.

--resource-group -g

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

az dt twin relationship show

Show details of a digital twin relationship.

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

Examples

Show details of a digital twin relationship.

az dt twin relationship show -n {instance_or_hostname} --twin-id {twin_id} --relationship-id {relationship_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.

--relationship-id -r

Relationship Id.

--source --twin-id -t

The source twin Id for a relationship.

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

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

Operations are limited to add, replace and remove.

az dt twin relationship update --dt-name
                               --json-patch
                               --relationship-id
                               --source
                               [--resource-group]

Examples

Update a digital twin relationship via JSON patch specification.

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

Update a digital twin relationship via JSON patch specification.

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

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

az dt twin relationship update -n {instance_or_hostname} --twin-id {twin_id} --relationship-id {relationship_id} --relationship contains --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.

--relationship-id -r

Relationship Id.

--source --twin-id -t

The source twin Id for a relationship.

Optional Parameters

--resource-group -g

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