az dt

Note

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

Manage Azure Digital Twins solutions & infrastructure.

Commands

az dt create

Create or update a Digital Twins instance.

az dt delete

Delete an existing Digital Twins instance.

az dt endpoint

Manage and configure Digital Twins instance endpoints.

az dt endpoint create

Add egress endpoints to a Digital Twins instance.

az dt endpoint create eventgrid

Adds an EventGrid Topic endpoint to a Digital Twins instance. Requires pre-created resource.

az dt endpoint create eventhub

Adds an EventHub endpoint to a Digital Twins instance. Requires pre-created resource. The instance must be created with a managed identity to support identity based endpoint integration.

az dt endpoint create servicebus

Adds a ServiceBus Topic endpoint to a Digital Twins instance. Requires pre-created resource. The instance must be created with a managed identity to support identity based endpoint integration.

az dt endpoint delete

Remove an endpoint from a Digital Twins instance.

az dt endpoint list

List all egress endpoints configured on a Digital Twins instance.

az dt endpoint show

Show details of an endpoint configured on a Digital Twins instance.

az dt endpoint wait

Wait until an endpoint operation is done.

az dt list

List the collection of Digital Twins instances by subscription or resource group.

az dt model

Manage DTDL models and definitions on a Digital Twins instance.

az dt model create

Uploads one or more models. When any error occurs, no models are uploaded.

az dt model delete

Delete a model. A model can only be deleted if no other models reference it.

az dt model delete-all

Delete all models within a Digital Twins instance. Twins configurations are not affected but may be broken without model definitions.

az dt model list

List model metadata, definitions and dependencies.

az dt model show

Retrieve a target model or model definition.

az dt model update

Updates the metadata for a model. Currently a model can only be decommisioned.

az dt network

Manage Digital Twins network configuration including private links and endpoint connections.

az dt network private-endpoint

Manage Digital Twins instance private-endpoints.

az dt network private-endpoint connection

Manage Digital Twins instance private-endpoint connections.

az dt network private-endpoint connection delete

Delete a private-endpoint connection associated with the Digital Twins instance.

az dt network private-endpoint connection list

List private-endpoint connections associated with the Digital Twins instance.

az dt network private-endpoint connection set

Set the state of a private-endpoint connection associated with the Digital Twins instance.

az dt network private-endpoint connection show

Show a private-endpoint connection associated with the Digital Twins instance.

az dt network private-endpoint connection wait

Wait until an operation on a private-endpoint connection is complete.

az dt network private-link

Manage Digital Twins instance private-link operations.

az dt network private-link list

List private-links associated with the Digital Twins instance.

az dt network private-link show

Show a private-link associated with the instance.

az dt reset

Reset an existing Digital Twins instance by deleting associated assets. Currently only supports deleting models and twins.

az dt role-assignment

Manage RBAC role assignments for a Digital Twins instance.

az dt role-assignment create

Assign a user, group or service principal to a role against a Digital Twins instance.

az dt role-assignment delete

Remove a user, group or service principal role assignment from a Digital Twins instance.

az dt role-assignment list

List the existing role assignments of a Digital Twins instance.

az dt route

Manage and configure event routes.

az dt route create

Add an event route to a Digital Twins instance.

az dt route delete

Remove an event route from a Digital Twins instance.

az dt route list

List the configured event routes of a Digital Twins instance.

az dt route show

Show details of an event route configured on a Digital Twins instance.

az dt show

Show an existing Digital Twins instance.

az dt twin

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

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

Deletes all digital twins within a Digital Twins instance, including all relationships for those twins.

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

Deletes all digital twin relationships within a Digital Twins instance, including incoming relationships.

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 wait

Wait until an operation on an Digital Twins instance is complete.

az dt create

Create or update a Digital Twins instance.

az dt create --dt-name
             --resource-group
             [--assign-identity {false, true}]
             [--location]
             [--pna {Disabled, Enabled}]
             [--role]
             [--scopes]
             [--tags]

Examples

Create instance in target resource group using the resource group location.

az dt create -n {instance_name} -g {resouce_group}

Create instance in target resource group with specified location and tags.

az dt create -n {instance_name} -g {resouce_group} -l westus --tags a=b c=d

Create instance in the target resource group with a system managed identity.

az dt create -n {instance_name} -g {resouce_group} --assign-identity

Create instance in the target resource group with a system managed identity then assign the identity to one or more scopes (space-separated) with the role of Contributor.

az dt create -n {instance_name} -g {resouce_group} --assign-identity --scopes "/subscriptions/a12345ea-bb21-994d-2263-c716348e32a1/resourceGroups/ProResourceGroup/providers/Microsoft.EventHub/namespaces/myEventHubNamespace/eventhubs/myEventHub" "/subscriptions/a12345ea-bb21-994d-2263-c716348e32a1/resourceGroups/ProResourceGroup/providers/Microsoft.ServiceBus/namespaces/myServiceBusNamespace/topics/myTopic"

Create instance in the target resource group with a system managed identity then assign the identity to one or more scopes with a custom specified role.

az dt create -n {instance_name} -g {resouce_group} --assign-identity --scopes "/subscriptions/a12345ea-bb21-994d-2263-c716348e32a1/resourceGroups/ProResourceGroup/providers/Microsoft.EventHub/namespaces/myEventHubNamespace/eventhubs/myEventHub" "/subscriptions/a12345ea-bb21-994d-2263-c716348e32a1/resourceGroups/ProResourceGroup/providers/Microsoft.ServiceBus/namespaces/myServiceBusNamespace/topics/myTopic" --role MyCustomRole

Update an instance in the target resource group to enable system managed identity.

az dt create -n {instance_name} -g {resouce_group} --assign-identity

Update an instance in the target resource group to disable system managed identity.

az dt create -n {instance_name} -g {resouce_group} --assign-identity false

Update an instance in the target resource group with new tag values and disable public network access.

az dt create -n {instance_name} -g {resouce_group} --tags env=prod --public-network-access Disabled

Required Parameters

--dt-name --dtn -n

Digital Twins instance name.

--resource-group -g

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

Optional Parameters

--assign-identity

Assign a system generated identity to the Digital Twins instance.

accepted values: false, true
--location -l

Digital Twins instance location. If no location is provided the resource group location is used.You can configure the default location using az configure --defaults location=<name>.

--pna --public-network-access

Determines if the Digital Twins instance can be accessed from a public network.

accepted values: Disabled, Enabled
default value: Enabled
--role

Role name or Id the system assigned identity will have.

default value: Contributor
--scopes

Space-seperated scopes the system assigned identity can access.

--tags

Digital Twins instance tags. Property bag in key-value pairs with the following format: a=b c=d.

az dt delete

Delete an existing Digital Twins instance.

az dt delete --dt-name
             [--no-wait]
             [--resource-group]
             [--yes]

Examples

Delete an arbitrary instance in blocking fashion with a confirmation prompt.

az dt delete -n {instance_name}

Delete an arbitrary instance with no blocking or prompt.

az dt delete -n {instance_name} -y --no-wait

Required Parameters

--dt-name --dtn -n

Digital Twins instance name.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

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

--yes -y

Do not prompt for confirmation.

az dt list

List the collection of Digital Twins instances by subscription or resource group.

az dt list [--resource-group]

Examples

List all instances in the current subscription.

az dt list

List all instances in target resource group and output in table format.

az dt list -g {resource_group} --output table

List all instances in subscription that meet a condition.

az dt list --query "[?contains(name, 'Production')]"

Count instances that meet condition.

az dt list --query "length([?contains(name, 'Production')])"

Optional Parameters

--resource-group -g

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

az dt reset

Reset an existing Digital Twins instance by deleting associated assets. Currently only supports deleting models and twins.

az dt reset --dt-name
            [--resource-group]
            [--yes]

Examples

Reset all assets for a Digital Twins instance.

az dt reset -n {instance_name}

Required Parameters

--dt-name --dtn -n

Digital Twins instance name.

Optional Parameters

--resource-group -g

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

--yes -y

Do not prompt for confirmation.

az dt show

Show an existing Digital Twins instance.

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

Examples

Show an instance.

az dt show -n {instance_name}

Show an instance and project certain properties.

az dt show -n {instance_name} --query "{Endpoint:hostName, Location:location}"

Required Parameters

--dt-name --dtn -n

Digital Twins instance name.

Optional Parameters

--resource-group -g

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

az dt wait

Wait until an operation on an Digital Twins instance is complete.

az dt wait --dt-name
           [--created]
           [--custom]
           [--deleted]
           [--exists]
           [--interval]
           [--resource-group]
           [--timeout]

Examples

Wait until an arbitrary instance is created.

az dt wait -n {instance_name} --created

Wait until an existing instance is deleted.

az dt wait -n {instance_name} --deleted

Wait until an existing instance's publicNetworkAccess property is set to Enabled

az dt wait -n {instance_name} --custom "publicNetworkAccess=='Enabled'"

Required Parameters

--dt-name --dtn -n

Digital Twins instance name.

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

--interval

Polling interval in seconds.

default value: 30
--resource-group -g

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

--timeout

Maximum wait in seconds.

default value: 3600