Skip to content

Commit 05dc165

Browse files
authored
Merge pull request #218793 from baanders/11-17-msi
ADT: Move MSI instructions
2 parents 51842d7 + de713ad commit 05dc165

File tree

4 files changed

+72
-108
lines changed

4 files changed

+72
-108
lines changed

articles/digital-twins/how-to-route-with-managed-identity.md

Lines changed: 7 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Mandatory fields.
33
title: Route events with a managed identity
44
titleSuffix: Azure Digital Twins
5-
description: See how to enable a system-assigned identity for Azure Digital Twins and use it to forward events, using the Azure portal or CLI.
5+
description: See how to use a system-assigned identity to forward events in Azure Digital Twins.
66
author: baanders
77
ms.author: baanders # Microsoft employees only
8-
ms.date: 02/23/2022
8+
ms.date: 11/17/2022
99
ms.topic: how-to
1010
ms.service: digital-twins
1111
ms.custom: subject-rbac-steps, contperf-fy21q4, devx-track-azurecli
@@ -18,92 +18,21 @@ ms.custom: subject-rbac-steps, contperf-fy21q4, devx-track-azurecli
1818

1919
# Enable a managed identity for routing Azure Digital Twins events
2020

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

2323
Here are the steps that are covered in this article:
2424

2525
1. Create an Azure Digital Twins instance with a system-assigned identity or enable system-assigned identity on an existing Azure Digital Twins instance.
2626
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.
2727
1. Create an endpoint in Azure Digital Twins that can use system-assigned identities for authentication.
2828

29-
## Enable system-managed identity for the instance
29+
## Create an Azure Digital Twins instance with a managed identity
3030

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

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

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

10837
## Assign Azure roles to the identity
10938

articles/digital-twins/how-to-set-up-instance-cli.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ titleSuffix: Azure Digital Twins
55
description: See how to set up an instance of the Azure Digital Twins service using the CLI
66
author: baanders
77
ms.author: baanders # Microsoft employees only
8-
ms.date: 02/24/2022
8+
ms.date: 11/17/2022
99
ms.topic: how-to
1010
ms.service: digital-twins
1111
ms.custom: contperf-fy22q2
@@ -48,6 +48,18 @@ az dt create --dt-name <name-for-your-Azure-Digital-Twins-instance> --resource-g
4848

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

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+
5163
### Verify success and collect important values
5264

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

99111
You now have an Azure Digital Twins instance ready to go, and have assigned permissions to manage it.
100112

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+
101135
## Next steps
102136

103137
Test out individual REST API calls on your instance using the Azure Digital Twins CLI commands:

articles/digital-twins/how-to-set-up-instance-portal.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ titleSuffix: Azure Digital Twins
55
description: See how to set up an instance of the Azure Digital Twins service using the Azure portal
66
author: baanders
77
ms.author: baanders # Microsoft employees only
8-
ms.date: 02/24/2022
8+
ms.date: 11/17/2022
99
ms.topic: how-to
1010
ms.service: digital-twins
1111
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
4949
Here are the additional options you can configure during setup, using the other tabs in the **Create Resource** process.
5050

5151
* **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).
5353
* **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).
5454

5555
### 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
123123

124124
You now have an Azure Digital Twins instance ready to go, and have assigned permissions to manage it.
125125

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+
126150
## Next steps
127151

128152
Test out individual REST API calls on your instance using the Azure Digital Twins CLI commands:

articles/digital-twins/how-to-use-data-history.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ titleSuffix: Azure Digital Twins
55
description: See how to set up and use data history for Azure Digital Twins, using the CLI or Azure portal.
66
author: baanders
77
ms.author: baanders # Microsoft employees only
8-
ms.date: 03/23/2022
8+
ms.date: 11/17/2022
99
ms.topic: how-to
1010
ms.service: digital-twins
1111
ms.custom: event-tier1-build-2022
@@ -72,34 +72,11 @@ databasename="<name-for-your-database>"
7272

7373
## Create an Azure Digital Twins instance with a managed identity
7474

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

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

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

10481
## Create an Event Hubs namespace and event hub
10582

0 commit comments

Comments
 (0)