แชร์ผ่าน


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

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

--if-none-match

Indicates the create operation should fail if an existing twin with the same id exists.

Default value: False
--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}.

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

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

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

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

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

Optional Parameters

--resource-group -g

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

--source --twin-id -t

The source twin Id for a relationship.

--yes -y

Do not prompt for confirmation.

Default value: False
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 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
Default value: False
--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}.

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

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

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

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