You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Enable a managed identity for routing Azure Digital Twins events
20
20
21
-
This article describes how to enable a [system-assigned identity for an Azure Digital Twins instance](concepts-security.md#managed-identity-for-accessing-other-resources), and use the identity when forwarding events to supported routing destinations. Setting up a managed identity isn't required for routing, but it can help the instance to easily access other Azure AD-protected resources, such as [Event Hubs](../event-hubs/event-hubs-about.md), [Service Bus](../service-bus-messaging/service-bus-messaging-overview.md) destinations, and [Azure Storage Container](../storage/blobs/storage-blobs-introduction.md).
21
+
This article describes how to use a [system-assigned identity for an Azure Digital Twins instance](concepts-security.md#managed-identity-for-accessing-other-resources) when forwarding events to supported routing destinations. Setting up a managed identity isn't required for routing, but it can help the instance to easily access other Azure AD-protected resources, such as [Event Hubs](../event-hubs/event-hubs-about.md), [Service Bus](../service-bus-messaging/service-bus-messaging-overview.md) destinations, and [Azure Storage Container](../storage/blobs/storage-blobs-introduction.md).
22
22
23
23
Here are the steps that are covered in this article:
24
24
25
25
1. Create an Azure Digital Twins instance with a system-assigned identity or enable system-assigned identity on an existing Azure Digital Twins instance.
26
26
1. Add an appropriate role or roles to the identity. For example, assign the **Azure Event Hub Data Sender** role to the identity if the endpoint is Event Hubs, or **Azure Service Bus Data Sender role** if the endpoint is Service Bus.
27
27
1. Create an endpoint in Azure Digital Twins that can use system-assigned identities for authentication.
28
28
29
-
## Enable system-managed identity for the instance
29
+
## Create an Azure Digital Twins instance with a managed identity
30
30
31
-
When you enable a system-assigned identity on your Azure Digital Twins instance, Azure automatically creates an identity for it in [Azure Active Directory (Azure AD)](../active-directory/fundamentals/active-directory-whatis.md). That identity can then be used to authenticate to Azure Digital Twins endpoints for event forwarding.
31
+
If you already have an Azure Digital Twins instance, ensure that you've enabled a [system-managed identity](how-to-set-up-instance-cli.md#enabledisable-system-managed-identity-for-the-instance)for it.
32
32
33
-
You can enable system-managed identities for an Azure Digital Twins instance in two different ways:
33
+
If you don't have an Azure Digital Twins instance, follow the instructions in [Create the instance with a system-managed identity](how-to-set-up-instance-cli.md#create-the-instance-with-a-system-managed-identity) to create an Azure Digital Twins instance with a managed identity for the first time.
34
34
35
-
- Enable it as part of the instance's initial setup.
36
-
- Enable it later on an instance that already exists.
37
-
38
-
Either of these creation methods will give the same configuration options and the same end result for your instance. This section describes how to do both.
39
-
40
-
### Add a system-managed identity during instance creation
41
-
42
-
In this section, you'll learn how to enable a system-managed identity for an Azure Digital Twins instance while the instance is being created. You can enable the identity whether you're creating the instance with the [Azure portal](https://portal.azure.com) or the [Azure CLI](/cli/azure/what-is-azure-cli). Use the tabs below to select instructions for your preferred experience.
43
-
44
-
# [Portal](#tab/portal)
45
-
46
-
To add a managed identity during instance creation in the portal, begin [creating an instance as you normally would](how-to-set-up-instance-portal.md).
47
-
48
-
The system-managed identity option is located in the **Advanced** tab of instance setup.
49
-
50
-
In this tab, select the **On** option for **System managed identity** to turn on this feature.
51
-
52
-
:::image type="content" source="media/how-to-route-with-managed-identity/create-instance-advanced.png" alt-text="Screenshot of the Azure portal showing the Advanced tab of the Create Resource dialog for Azure Digital Twins. System managed identity is turned on.":::
53
-
54
-
You can then use the bottom navigation buttons to continue with the rest of instance setup.
55
-
56
-
# [CLI](#tab/cli)
57
-
58
-
In the CLI, you can add an `--assign-identity` parameter to the `az dt create` command that's used to create the instance. (For more information about this command, see its [reference documentation](/cli/azure/dt#az-dt-create) or the [general instructions for setting up an Azure Digital Twins instance](how-to-set-up-instance-cli.md#create-the-azure-digital-twins-instance)).
59
-
60
-
To create an instance with a system managed identity, add the `--assign-identity` parameter like this:
61
-
62
-
```azurecli-interactive
63
-
az dt create --dt-name <new-instance-name> --resource-group <resource-group> --assign-identity
64
-
```
65
-
66
-
---
67
-
68
-
### Add a system-managed identity to an existing instance
69
-
70
-
In this section, you'll add a system-managed identity to an Azure Digital Twins instance that already exists. Use the tabs below to select instructions for your preferred experience.
71
-
72
-
# [Portal](#tab/portal)
73
-
74
-
Start by opening the [Azure portal](https://portal.azure.com) in a browser.
75
-
76
-
1. Search for the name of your instance in the portal search bar, and select it to view its details.
77
-
78
-
1. Select **Identity** in the left-hand menu.
79
-
80
-
1. On this page, select the **On** option to turn on this feature.
81
-
82
-
1. Select the **Save** button, and **Yes** to confirm.
83
-
84
-
:::image type="content" source="media/how-to-route-with-managed-identity/identity-digital-twins.png" alt-text="Screenshot of the Azure portal showing the Identity page for an Azure Digital Twins instance." lightbox="media/how-to-route-with-managed-identity/identity-digital-twins.png":::
85
-
86
-
After the change is saved, more fields will appear on this page for the new identity's **Object ID** and **Permissions**.
87
-
88
-
You can copy the **Object ID** from here if needed, and use the **Permissions** button to view the Azure roles that are assigned to the identity. To set up some roles, continue to the next section.
89
-
90
-
# [CLI](#tab/cli)
91
-
92
-
Again, you can add the identity to your instance by using the `az dt create` command and `--assign-identity` parameter. Instead of providing a new name of an instance to create, you can provide the name of an instance that already exists to update the value of `--assign-identity` for that instance.
93
-
94
-
The command to enable managed identity is the same as the command to create an instance with a system managed identity. All that changes is the value of the instance name parameter:
95
-
96
-
```azurecli-interactive
97
-
az dt create --dt-name <name-of-existing-instance> --resource-group <resource-group> --assign-identity
98
-
```
99
-
100
-
To disable managed identity on an instance where it's currently enabled, use the following similar command to set `--assign-identity` to `false`.
101
-
102
-
```azurecli-interactive
103
-
az dt create --dt-name <name-of-existing-instance> --resource-group <resource-group> --assign-identity false
104
-
```
105
-
106
-
---
35
+
Then, make sure you have *Azure Digital Twins Data Owner* role on the instance. You can find instructions in [Set up user access permissions](how-to-set-up-instance-cli.md#set-up-user-access-permissions).
Copy file name to clipboardExpand all lines: articles/digital-twins/how-to-set-up-instance-cli.md
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ titleSuffix: Azure Digital Twins
5
5
description: See how to set up an instance of the Azure Digital Twins service using the CLI
6
6
author: baanders
7
7
ms.author: baanders # Microsoft employees only
8
-
ms.date: 02/24/2022
8
+
ms.date: 11/17/2022
9
9
ms.topic: how-to
10
10
ms.service: digital-twins
11
11
ms.custom: contperf-fy22q2
@@ -48,6 +48,18 @@ az dt create --dt-name <name-for-your-Azure-Digital-Twins-instance> --resource-g
48
48
49
49
There are several optional parameters that can be added to the command to specify additional things about your resource during creation, including creating a [system managed identity](concepts-security.md#managed-identity-for-accessing-other-resources) for the instance or enabling/disabling public network access. For a full list of supported parameters, see the [az dt create](/cli/azure/dt#az-dt-create) reference documentation.
50
50
51
+
### Create the instance with a system-managed identity
52
+
53
+
When you enable a [system-assigned identity](concepts-security.md#managed-identity-for-accessing-other-resources) on your Azure Digital Twins instance, Azure automatically creates an identity for it in [Azure Active Directory (Azure AD)](../active-directory/fundamentals/active-directory-whatis.md). That identity can then be used to authenticate to Azure Digital Twins endpoints for event forwarding. You can enable a system-managed identity for an Azure Digital Twins instance during instance creation, or [later on an existing instance](#enabledisable-system-managed-identity-for-the-instance).
54
+
55
+
To create an Azure Digital Twins instance with system-assigned identity enabled, you can add an `--assign-identity` parameter to the `az dt create` command that's used to create the instance. (For more information about this command, see its [reference documentation](/cli/azure/dt#az-dt-create) or the [general instructions for setting up an Azure Digital Twins instance](how-to-set-up-instance-cli.md#create-the-azure-digital-twins-instance)).
56
+
57
+
To create an instance with a system managed identity, add the `--assign-identity` parameter like this:
58
+
59
+
```azurecli-interactive
60
+
az dt create --dt-name <new-instance-name> --resource-group <resource-group> --assign-identity
61
+
```
62
+
51
63
### Verify success and collect important values
52
64
53
65
If the instance was created successfully, the result in the CLI looks something like this, outputting information about the resource you have created:
@@ -98,6 +110,28 @@ The result of this command is outputted information about the role assignment th
98
110
99
111
You now have an Azure Digital Twins instance ready to go, and have assigned permissions to manage it.
100
112
113
+
## Enable/disable system-managed identity for the instance
114
+
115
+
This section shows you how to add a system-managed identity to an existing Azure Digital Twins instance. You can also disable system-managed identity on an instance that has it already.
116
+
117
+
The command to enable managed identity for an existing instance is the same `az dt create` command that's used to [create a new instance with a system managed identity](#create-the-instance-with-a-system-managed-identity). Instead of providing a new name of an instance to create, you can provide the name of an instance that already exists. Then, make sure to add the `--assign-identity` parameter.
118
+
119
+
```azurecli-interactive
120
+
az dt create --dt-name <name-of-existing-instance> --resource-group <resource-group> --assign-identity
121
+
```
122
+
123
+
To disable managed identity on an instance where it's currently enabled, use the following similar command to set `--assign-identity` to `false`.
124
+
125
+
```azurecli-interactive
126
+
az dt create --dt-name <name-of-existing-instance> --resource-group <resource-group> --assign-identity false
127
+
```
128
+
129
+
### Considerations for disabling system-managed identities
130
+
131
+
It's important to consider the effects that any changes to the identity or its roles can have on the resources that use it. If you're [using managed identities with your Azure Digital Twins endpoints](how-to-route-with-managed-identity.md) or for [data history](how-to-use-data-history.md) and the identity is disabled, or a necessary role is removed from it, the endpoint or data history connection can become inaccessible and the flow of events will be disrupted.
132
+
133
+
To continue using an endpoint that was set up with a managed identity that's now been disabled, you'll need to delete the endpoint and [re-create it](how-to-manage-routes.md#create-an-endpoint-for-azure-digital-twins) with a different authentication type. It may take up to an hour for events to resume delivery to the endpoint after this change.
134
+
101
135
## Next steps
102
136
103
137
Test out individual REST API calls on your instance using the Azure Digital Twins CLI commands:
Copy file name to clipboardExpand all lines: articles/digital-twins/how-to-set-up-instance-portal.md
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ titleSuffix: Azure Digital Twins
5
5
description: See how to set up an instance of the Azure Digital Twins service using the Azure portal
6
6
author: baanders
7
7
ms.author: baanders # Microsoft employees only
8
-
ms.date: 02/24/2022
8
+
ms.date: 11/17/2022
9
9
ms.topic: how-to
10
10
ms.service: digital-twins
11
11
ms.custom: contperf-fy21q2, subject-rbac-steps
@@ -49,7 +49,7 @@ This version of this article goes through these steps manually, one by one, usin
49
49
Here are the additional options you can configure during setup, using the other tabs in the **Create Resource** process.
50
50
51
51
***Networking**: In this tab, you can enable private endpoints with [Azure Private Link](../private-link/private-link-overview.md) to eliminate public network exposure to your instance. For instructions, see [Enable private access with Private Link](./how-to-enable-private-link.md?tabs=portal#add-a-private-endpoint-during-instance-creation).
52
-
***Advanced**: In this tab, you can enable a system-managed identity for your instance that can be used when forwarding events along [event routes](concepts-route-events.md). For more information about using system-managed identities with Azure Digital Twins, see [Security for Azure Digital Twins solutions](concepts-security.md#managed-identity-for-accessing-other-resources).
52
+
***Advanced**: In this tab, you can enable a [system-managed identity](concepts-security.md#managed-identity-for-accessing-other-resources) for your instance. When this is enabled, Azure automatically creates an identity for the instance in [Azure Active Directory (Azure AD)](../active-directory/fundamentals/active-directory-whatis.md). That identity can then be used to authenticate to Azure Digital Twins endpoints for event forwarding. You can enable that system-managed identity here, or [later on an existing instance](#enabledisable-system-managed-identity-for-the-instance).
53
53
***Tags**: In this tab, you can add tags to your instance to help you organize it among your Azure resources. For more about Azure resource tags, see [Tag resources, resource groups, and subscriptions for logical organization](../azure-resource-manager/management/tag-resources.md).
54
54
55
55
### Verify success and collect important values
@@ -123,6 +123,30 @@ You can view the role assignment you've set up under **Access control (IAM) > Ro
123
123
124
124
You now have an Azure Digital Twins instance ready to go, and have assigned permissions to manage it.
125
125
126
+
## Enable/disable system-managed identity for the instance
127
+
128
+
This section shows you how to add a system-managed identity to an existing Azure Digital Twins instance. You can also use this page to disable system-managed identity on an instance that has it already.
129
+
130
+
Start by opening the [Azure portal](https://portal.azure.com) in a browser.
131
+
132
+
1. Search for the name of your instance in the portal search bar, and select it to view its details.
133
+
134
+
1. Select **Identity** in the left-hand menu.
135
+
136
+
1. On this page, select the **On** option to turn on this feature.
137
+
138
+
1. Select the **Save** button, and **Yes** to confirm.
139
+
140
+
:::image type="content" source="media/how-to-route-with-managed-identity/identity-digital-twins.png" alt-text="Screenshot of the Azure portal showing the Identity page for an Azure Digital Twins instance." lightbox="media/how-to-route-with-managed-identity/identity-digital-twins.png":::
141
+
142
+
After the change is saved, more fields will appear on this page for the new identity's **Object ID** and **Permissions**.
143
+
144
+
You can copy the **Object ID** from here if needed, and use the **Permissions** button to view the Azure roles that are assigned to the identity. To set up some roles, continue to the next section.
145
+
146
+
### Considerations for disabling system-managed identities
147
+
148
+
It's important to consider the effects that any changes to the identity or its roles can have on the resources that use it. If you're [using managed identities with your Azure Digital Twins endpoints](how-to-route-with-managed-identity.md) or for [data history](how-to-use-data-history.md) and the identity is disabled, or a necessary role is removed from it, the endpoint or data history connection can become inaccessible and the flow of events will be disrupted.
149
+
126
150
## Next steps
127
151
128
152
Test out individual REST API calls on your instance using the Azure Digital Twins CLI commands:
## Create an Azure Digital Twins instance with a managed identity
74
74
75
-
If you already have an Azure Digital Twins instance, ensure that you've enabled a [system-managed identity](how-to-route-with-managed-identity.md#add-a-system-managed-identity-to-an-existing-instance) for it.
75
+
If you already have an Azure Digital Twins instance, ensure that you've enabled a [system-managed identity](how-to-set-up-instance-cli.md#enabledisable-system-managed-identity-for-the-instance) for it.
76
76
77
-
If you don't have an Azure Digital Twins instance, set one up using the instructions in this section.
77
+
If you don't have an Azure Digital Twins instance, follow the instructions in [Create the instance with a system-managed identity](how-to-set-up-instance-cli.md#create-the-instance-with-a-system-managed-identity) to create an Azure Digital Twins instance with a managed identity for the first time.
78
78
79
-
# [CLI](#tab/cli)
80
-
81
-
Use the following command to create a new instance with a system-managed identity. The command uses three local variables (`$dtname`, `$resourcegroup`, and `$location`) that were created earlier in [Set up local variables for CLI session](#set-up-local-variables-for-cli-session).
82
-
83
-
```azurecli-interactive
84
-
az dt create --dt-name $dtname --resource-group $resourcegroup --location $location --assign-identity
85
-
```
86
-
87
-
Next, use the following command to grant yourself the *Azure Digital Twins Data Owner* role on the instance. The command has one placeholder, `<[email protected]>`, that you should replace with your own Azure account information, and uses a local variable (`$dtname`) that was created earlier in [Set up local variables for CLI session](#set-up-local-variables-for-cli-session).
88
-
89
-
```azurecli-interactive
90
-
az dt role-assignment create --dt-name $dtname --assignee "<[email protected]>" --role "Azure Digital Twins Data Owner"
91
-
```
92
-
93
-
>[!NOTE]
94
-
>It may take up to five minutes for this RBAC change to apply.
95
-
96
-
# [Portal](#tab/portal)
97
-
98
-
Follow the instructions in [Set up an Azure Digital Twins instance and authentication](how-to-set-up-instance-portal.md) to create an instance, making sure to enable a **system-managed identity** in the [Advanced](how-to-set-up-instance-portal.md#additional-setup-options) tab during setup. Then, continue through the article's instructions to set up user access permissions so that you have the Azure Digital Twins Data Owner role on the instance.
99
-
100
-
Remember the name you give to your instance so you can use it later.
101
-
102
-
---
79
+
Then, make sure you have *Azure Digital Twins Data Owner* role on the instance. You can find instructions in [Set up user access permissions](how-to-set-up-instance-cli.md#set-up-user-access-permissions).
0 commit comments