az dt twin relationship
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 relationship command. Learn more about extensions.
Manage and configure the digital twin relationships of a Digital Twins instance.
Commands
Name | Description | Type | Status |
---|---|---|---|
az dt twin relationship create |
Create a relationship between source and target digital twins. |
Extension | GA |
az dt twin relationship delete |
Delete a digital twin relationship on a Digital Twins instance. |
Extension | GA |
az dt twin relationship delete-all |
Deletes all digital twin relationships within a Digital Twins instance, including incoming relationships. |
Extension | GA |
az dt twin relationship list |
List the relationships of a digital twin. |
Extension | GA |
az dt twin relationship show |
Show details of a digital twin relationship. |
Extension | GA |
az dt twin relationship update |
Updates the properties of a relationship between two digital twins via JSON patch specification. |
Extension | GA |
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
[--if-none-match]
[--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 between two digital twins with if-none-match tag
az dt twin relationship create -n {instance_or_hostname} --relationship-id {relationship_id} --relationship contains --twin-id {source_twin_id} --target {target_twin_id} --if-none-match
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
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 name or kind. For example: 'contains'.
Relationship Id.
The source twin Id for a relationship.
The target twin Id for a relationship.
Optional Parameters
Indicates the create operation should fail if an existing twin with the same id exists.
Initial property values for instantiating a digital twin relationship. Provide file path or inline JSON.
Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}
.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
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
[--etag]
[--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}
Delete a digital twin relationship using the etag.
az dt twin relationship delete -n {instance_or_hostname} --twin-id {twin_id} --relationship-id {relationship_id} --etag {etag}
Required Parameters
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.
The source twin Id for a relationship.
Optional Parameters
Entity tag value. The command will succeed if the etag matches the current etag for the resource.
Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}
.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az dt twin relationship delete-all
Deletes all digital twin relationships within a Digital Twins instance, including incoming relationships.
az dt twin relationship delete-all --dt-name
[--resource-group]
[--source]
[--yes]
Examples
Delete all digital twin relationships associated with the twin.
az dt twin relationship delete-all -n {instance_or_hostname} --twin-id {twin_id}
Delete all digital twin relationships within the Digital Twins instace.
az dt twin relationship delete-all -n {instance_or_hostname}
Required Parameters
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.
Optional Parameters
Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}
.
The source twin Id for a relationship.
Do not prompt for confirmation.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
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
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.
The source twin Id for a relationship.
Optional Parameters
Retrieves all incoming relationships for a digital twin.
Filter result by the kind of relationship.
Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}
.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
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
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.
The source twin Id for a relationship.
Optional Parameters
Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}
.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
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
[--etag]
[--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 and using etag.
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}' --etag {etag}
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
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.
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.
The source twin Id for a relationship.
Optional Parameters
Entity tag value. The command will succeed if the etag matches the current etag for the resource.
Digital Twins instance resource group. You can configure the default group using az configure --defaults group={name}
.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Azure CLI