Skip to content

Commit e4e27e6

Browse files
committed
Emphasize managed identities
1 parent f8de0fc commit e4e27e6

File tree

4 files changed

+152
-152
lines changed

4 files changed

+152
-152
lines changed

articles/iot-central/core/howto-export-to-azure-data-explorer.md

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to use the IoT Central data export capability to continuo
44
services: iot-central
55
author: dominicbetts
66
ms.author: dobett
7-
ms.date: 05/22/2023
7+
ms.date: 03/05/2024
88
ms.topic: how-to
99
ms.service: iot-central
1010
---
@@ -35,29 +35,42 @@ Azure Data Explorer destinations let you configure the connection with a *servic
3535

3636
### Create an Azure Data Explorer destination
3737

38-
# [Service principal](#tab/service-principal)
38+
# [Managed identity](#tab/managed-identity)
3939

40-
If you don't have an existing Azure Data Explorer database to export to, follow these steps:
40+
This article shows how to create a managed identity using the Azure CLI. You can also use the Azure portal to create a managed identity.
4141

42-
1. You have two choices to create an Azure Data Explorer database:
42+
If you don't have an existing Azure Data Explorer database to export to, follow these steps. You have two choices to create an Azure Data Explorer database:
4343

44-
- Create a new Azure Data Explorer cluster and database. To learn more, see the [Azure Data Explorer quickstart](/azure/data-explorer/create-cluster-database-portal). Make a note of the cluster URI and the name of the database you create, you need these values in the following steps.
45-
- Create a new Azure Synapse Data Explorer pool and database. To learn more, see the [Azure Data Explorer quickstart](../../synapse-analytics/get-started-analyze-data-explorer.md). Make a note of the pool URI and the name of the database you create, you need these values in the following steps.
44+
- Create a new Azure Data Explorer cluster and database. To learn more, see the [Azure Data Explorer quickstart](/azure/data-explorer/create-cluster-database-portal). Make a note of the cluster URI and the name of the database you create, you need these values in the following steps.
45+
- Create a new Azure Synapse Data Explorer pool and database. To learn more, see the [Azure Data Explorer quickstart](../../synapse-analytics/get-started-analyze-data-explorer.md). Make a note of the pool URI and the name of the database you create, you need these values in the following steps.
4646

47-
1. Create a service principal that you can use to connect your IoT Central application to Azure Data Explorer. Use the Azure Cloud Shell to run the following command:
47+
To configure the managed identity that enables your IoT Central application to securely export data to your Azure resource:
48+
49+
1. Create a managed identity for your IoT Central application to use to connect to your database. Use the Azure Cloud Shell to run the following command:
4850

4951
```azurecli
50-
az ad sp create-for-rbac --skip-assignment --name "My SP for IoT Central" --scopes /subscriptions/<SubscriptionId>
52+
az iot central app identity assign --name {your IoT Central app name} \
53+
--resource-group {resource group name} \
54+
--system-assigned
5155
```
5256
53-
Make a note of the `appId`, `password`, and `tenant` values in the command output, you need them in the following steps.
57+
Make a note of the `principalId` and `tenantId` output by the command. You use these values in the following step.
5458
55-
1. To add the service principal to the database, navigate to the Azure Data Explorer portal and run the following query on your database. Replace the placeholders with the values you made a note of previously:
59+
1. Configure the database permissions to allow connections from your IoT Central application. Use the Azure Cloud Shell to run the following command:
5660
57-
```kusto
58-
.add database ['<YourDatabaseName>'] admins ('aadapp=<YourAppId>;<YourTenant>');
61+
```azurecli
62+
az kusto database-principal-assignment create --cluster-name {name of your cluster} \
63+
--database-name {name of your database} \
64+
--resource-group {resource group name} \
65+
--principal-assignment-name {name of your IoT Central application} \
66+
--principal-id {principal id from the previous step} \
67+
--principal-type App --role Admin \
68+
--tenant-id {tenant id from the previous step}
5969
```
6070
71+
> [!TIP]
72+
> If you're using Azure Synapse, see [`az synapse kusto database-principal-assignment`](/cli/azure/synapse/kusto/database-principal-assignment).
73+
6174
1. Create a table in your database with a suitable schema for the data you're exporting. The following example query creates a table called `smartvitalspatch`. To learn more, see [Transform data inside your IoT Central application for export](howto-transform-data-internally.md):
6275
6376
```kusto
@@ -90,55 +103,38 @@ To create the Azure Data Explorer destination in IoT Central on the **Data expor
90103
91104
1. Select **Azure Data Explorer** as the destination type.
92105
93-
1. Enter your Azure Data Explorer cluster or pool URL, database name, and table name. The following table shows the service principal values to use for the authorization:
94-
95-
| Service principal value | Destination configuration |
96-
| ----------------------- | ------------------------- |
97-
| appId | ClientID |
98-
| tenant | Tenant ID |
99-
| password | Client secret |
106+
1. Enter your Azure Data Explorer cluster or pool URL, database name, and table name. Select **System-assigned managed identity** as the authorization type.
100107
101108
> [!TIP]
102109
> The cluster URL for a standalone Azure Data Explorer looks like `https://<ClusterName>.<AzureRegion>.kusto.windows.net`. The cluster URL for an Azure Synapse Data Explorer pool looks like `https://<DataExplorerPoolName>.<SynapseWorkspaceName>.kusto.azuresynapse.net`.
103110
104-
:::image type="content" source="media/howto-export-data/export-destination.png" alt-text="Screenshot of Azure Data Explorer export destination that uses a service principal.":::
111+
:::image type="content" source="media/howto-export-data/export-destination-managed.png" alt-text="Screenshot of Azure Data Explorer export destination that uses a managed identity.":::
105112
106-
# [Managed identity](#tab/managed-identity)
113+
If you don't see data arriving in your destination service, see [Troubleshoot issues with data exports from your Azure IoT Central application](troubleshooting.md).
107114
108-
This article shows how to create a managed identity using the Azure CLI. You can also use the Azure portal to create a managed identity.
115+
# [Service principal](#tab/service-principal)
109116
110-
If you don't have an existing Azure Data Explorer database to export to, follow these steps. You have two choices to create an Azure Data Explorer database:
117+
If you don't have an existing Azure Data Explorer database to export to, follow these steps:
111118
112-
- Create a new Azure Data Explorer cluster and database. To learn more, see the [Azure Data Explorer quickstart](/azure/data-explorer/create-cluster-database-portal). Make a note of the cluster URI and the name of the database you create, you need these values in the following steps.
113-
- Create a new Azure Synapse Data Explorer pool and database. To learn more, see the [Azure Data Explorer quickstart](../../synapse-analytics/get-started-analyze-data-explorer.md). Make a note of the pool URI and the name of the database you create, you need these values in the following steps.
119+
1. You have two choices to create an Azure Data Explorer database:
114120
115-
To configure the managed identity that enables your IoT Central application to securely export data to your Azure resource:
121+
- Create a new Azure Data Explorer cluster and database. To learn more, see the [Azure Data Explorer quickstart](/azure/data-explorer/create-cluster-database-portal). Make a note of the cluster URI and the name of the database you create, you need these values in the following steps.
122+
- Create a new Azure Synapse Data Explorer pool and database. To learn more, see the [Azure Data Explorer quickstart](../../synapse-analytics/get-started-analyze-data-explorer.md). Make a note of the pool URI and the name of the database you create, you need these values in the following steps.
116123
117-
1. Create a managed identity for your IoT Central application to use to connect to your database. Use the Azure Cloud Shell to run the following command:
124+
1. Create a service principal that you can use to connect your IoT Central application to Azure Data Explorer. Use the Azure Cloud Shell to run the following command:
118125
119126
```azurecli
120-
az iot central app identity assign --name {your IoT Central app name} \
121-
--resource-group {resource group name} \
122-
--system-assigned
127+
az ad sp create-for-rbac --skip-assignment --name "My SP for IoT Central" --scopes /subscriptions/<SubscriptionId>
123128
```
124129
125-
Make a note of the `principalId` and `tenantId` output by the command. You use these values in the following step.
130+
Make a note of the `appId`, `password`, and `tenant` values in the command output, you need them in the following steps.
126131
127-
1. Configure the database permissions to allow connections from your IoT Central application. Use the Azure Cloud Shell to run the following command:
132+
1. To add the service principal to the database, navigate to the Azure Data Explorer portal and run the following query on your database. Replace the placeholders with the values you made a note of previously:
128133
129-
```azurecli
130-
az kusto database-principal-assignment create --cluster-name {name of your cluster} \
131-
--database-name {name of your database} \
132-
--resource-group {resource group name} \
133-
--principal-assignment-name {name of your IoT Central application} \
134-
--principal-id {principal id from the previous step} \
135-
--principal-type App --role Admin \
136-
--tenant-id {tenant id from the previous step}
134+
```kusto
135+
.add database ['<YourDatabaseName>'] admins ('aadapp=<YourAppId>;<YourTenant>');
137136
```
138137
139-
> [!TIP]
140-
> If you're using Azure Synapse, see [`az synapse kusto database-principal-assignment`](/cli/azure/synapse/kusto/database-principal-assignment).
141-
142138
1. Create a table in your database with a suitable schema for the data you're exporting. The following example query creates a table called `smartvitalspatch`. To learn more, see [Transform data inside your IoT Central application for export](howto-transform-data-internally.md):
143139
144140
```kusto
@@ -171,14 +167,18 @@ To create the Azure Data Explorer destination in IoT Central on the **Data expor
171167
172168
1. Select **Azure Data Explorer** as the destination type.
173169
174-
1. Enter your Azure Data Explorer cluster or pool URL, database name, and table name. Select **System-assigned managed identity** as the authorization type.
170+
1. Enter your Azure Data Explorer cluster or pool URL, database name, and table name. The following table shows the service principal values to use for the authorization:
171+
172+
| Service principal value | Destination configuration |
173+
| ----------------------- | ------------------------- |
174+
| appId | ClientID |
175+
| tenant | Tenant ID |
176+
| password | Client secret |
175177
176178
> [!TIP]
177179
> The cluster URL for a standalone Azure Data Explorer looks like `https://<ClusterName>.<AzureRegion>.kusto.windows.net`. The cluster URL for an Azure Synapse Data Explorer pool looks like `https://<DataExplorerPoolName>.<SynapseWorkspaceName>.kusto.azuresynapse.net`.
178180
179-
:::image type="content" source="media/howto-export-data/export-destination-managed.png" alt-text="Screenshot of Azure Data Explorer export destination that uses a managed identity.":::
180-
181-
If you don't see data arriving in your destination service, see [Troubleshoot issues with data exports from your Azure IoT Central application](troubleshooting.md).
181+
:::image type="content" source="media/howto-export-data/export-destination.png" alt-text="Screenshot of Azure Data Explorer export destination that uses a service principal.":::
182182
183183
---
184184

articles/iot-central/core/howto-export-to-blob-storage.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to use the IoT Central data export capability to continuo
44
services: iot-central
55
author: dominicbetts
66
ms.author: dobett
7-
ms.date: 05/22/2023
7+
ms.date: 03/05/2024
88
ms.topic: how-to
99
ms.service: iot-central
1010
ms.custom: devx-track-azurecli
@@ -38,25 +38,39 @@ Blob Storage destinations let you configure the connection with a *connection st
3838

3939
### Create an Azure Blob Storage destination
4040

41-
# [Connection string](#tab/connection-string)
41+
# [Managed identity](#tab/managed-identity)
4242

43+
This article shows how to create a managed identity using the Azure CLI. You can also use the Azure portal to create a manged identity.
4344

44-
If you don't have an existing Azure storage account to export to, run the following script in the Azure Cloud Shell bash environment. The script creates a resource group, Azure Storage account, and blob container. It then prints the connection string to use when you configure the data export in IoT Central:
45+
If you don't have an existing Azure storage account to export to, run the following script in the Azure Cloud Shell bash environment. The script creates a resource group, Azure Storage account, and blob container. The script then enables the managed identity for your IoT Central application and assigns the role it needs to access your storage account:
4546

4647
```azurecli-interactive
47-
# Replace the storage account name with your own unique value
48+
# Replace the storage account name with your own unique value.
4849
SA=yourstorageaccount$RANDOM
50+
51+
# Replace the IoT Central app name with the name of your
52+
# IoT Central application.
53+
CA=your-iot-central-app
54+
4955
CN=exportdata
5056
RG=centralexportresources
5157
LOCATION=eastus
5258
5359
az group create -n $RG --location $LOCATION
54-
az storage account create --name $SA --resource-group $RG --location $LOCATION --sku Standard_LRS
60+
SAID=$(az storage account create --name $SA --resource-group $RG --location $LOCATION --sku Standard_LRS --query "id" --output tsv)
5561
az storage container create --account-name $SA --resource-group $RG --name $CN
5662
57-
CS=$(az storage account show-connection-string --resource-group $RG --name $SA --query "connectionString" --output tsv)
63+
# This assumes your IoT Central application is in the
64+
# default `IOTC` resource group.
65+
az iot central app identity assign --name $CA --resource-group IOTC --system-assigned
66+
PI=$(az iot central app identity show --name $CA --resource-group IOTC --query "principalId" --output tsv)
5867
59-
echo "Storage connection string: $CS"
68+
az role assignment create --assignee $PI --role "Storage Blob Data Contributor" --scope $SAID
69+
70+
az role assignment list --assignee $PI --all -o table
71+
72+
echo "Endpoint URI: https://$SA.blob.core.windows.net/"
73+
echo "Container: $CN"
6074
```
6175

6276
You can learn more about creating new [Azure Blob Storage accounts](../../storage/blobs/storage-quickstart-blobs-portal.md) or [Azure Data Lake Storage v2 storage accounts](../../storage/common/storage-account-create.md). Data export can only write data to storage accounts that support block blobs. The following table shows the known compatible storage account types:
@@ -68,51 +82,41 @@ You can learn more about creating new [Azure Blob Storage accounts](../../storag
6882
|Standard|Blob storage|
6983
|Premium|Block Blob storage|
7084

85+
To further secure your blob container and only allow access from trusted services with managed identities, see [Export data to a secure destination on an Azure Virtual Network](howto-connect-secure-vnet.md).
86+
7187
To create the Blob Storage destination in IoT Central on the **Data export** page:
7288

7389
1. Select **+ New destination**.
7490

7591
1. Select **Azure Blob Storage** as the destination type.
7692

77-
1. Select **Connection string** as the authorization type.
93+
1. Select **System-assigned managed identity** as the authorization type.
7894

79-
1. Paste in the connection string for your Blob Storage resource, and enter the case-sensitive container name if necessary.
95+
1. Enter the endpoint URI for your storage account and the case-sensitive container name. An endpoint URI looks like: `https://contosowaste.blob.core.windows.net`.
8096

8197
1. Select **Save**.
8298

83-
# [Managed identity](#tab/managed-identity)
99+
If you don't see data arriving in your destination service, see [Troubleshoot issues with data exports from your Azure IoT Central application](troubleshooting.md).
84100

85-
This article shows how to create a managed identity using the Azure CLI. You can also use the Azure portal to create a manged identity.
101+
# [Connection string](#tab/connection-string)
86102

87-
If you don't have an existing Azure storage account to export to, run the following script in the Azure Cloud Shell bash environment. The script creates a resource group, Azure Storage account, and blob container. The script then enables the managed identity for your IoT Central application and assigns the role it needs to access your storage account:
103+
104+
If you don't have an existing Azure storage account to export to, run the following script in the Azure Cloud Shell bash environment. The script creates a resource group, Azure Storage account, and blob container. It then prints the connection string to use when you configure the data export in IoT Central:
88105

89106
```azurecli-interactive
90-
# Replace the storage account name with your own unique value.
107+
# Replace the storage account name with your own unique value
91108
SA=yourstorageaccount$RANDOM
92-
93-
# Replace the IoT Central app name with the name of your
94-
# IoT Central application.
95-
CA=your-iot-central-app
96-
97109
CN=exportdata
98110
RG=centralexportresources
99111
LOCATION=eastus
100112
101113
az group create -n $RG --location $LOCATION
102-
SAID=$(az storage account create --name $SA --resource-group $RG --location $LOCATION --sku Standard_LRS --query "id" --output tsv)
114+
az storage account create --name $SA --resource-group $RG --location $LOCATION --sku Standard_LRS
103115
az storage container create --account-name $SA --resource-group $RG --name $CN
104116
105-
# This assumes your IoT Central application is in the
106-
# default `IOTC` resource group.
107-
az iot central app identity assign --name $CA --resource-group IOTC --system-assigned
108-
PI=$(az iot central app identity show --name $CA --resource-group IOTC --query "principalId" --output tsv)
109-
110-
az role assignment create --assignee $PI --role "Storage Blob Data Contributor" --scope $SAID
111-
112-
az role assignment list --assignee $PI --all -o table
117+
CS=$(az storage account show-connection-string --resource-group $RG --name $SA --query "connectionString" --output tsv)
113118
114-
echo "Endpoint URI: https://$SA.blob.core.windows.net/"
115-
echo "Container: $CN"
119+
echo "Storage connection string: $CS"
116120
```
117121

118122
You can learn more about creating new [Azure Blob Storage accounts](../../storage/blobs/storage-quickstart-blobs-portal.md) or [Azure Data Lake Storage v2 storage accounts](../../storage/common/storage-account-create.md). Data export can only write data to storage accounts that support block blobs. The following table shows the known compatible storage account types:
@@ -124,22 +128,18 @@ You can learn more about creating new [Azure Blob Storage accounts](../../storag
124128
|Standard|Blob storage|
125129
|Premium|Block Blob storage|
126130

127-
To further secure your blob container and only allow access from trusted services with managed identities, see [Export data to a secure destination on an Azure Virtual Network](howto-connect-secure-vnet.md).
128-
129131
To create the Blob Storage destination in IoT Central on the **Data export** page:
130132

131133
1. Select **+ New destination**.
132134

133135
1. Select **Azure Blob Storage** as the destination type.
134136

135-
1. Select **System-assigned managed identity** as the authorization type.
137+
1. Select **Connection string** as the authorization type.
136138

137-
1. Enter the endpoint URI for your storage account and the case-sensitive container name. An endpoint URI looks like: `https://contosowaste.blob.core.windows.net`.
139+
1. Paste in the connection string for your Blob Storage resource, and enter the case-sensitive container name if necessary.
138140

139141
1. Select **Save**.
140142

141-
If you don't see data arriving in your destination service, see [Troubleshoot issues with data exports from your Azure IoT Central application](troubleshooting.md).
142-
143143
---
144144

145145
[!INCLUDE [iot-central-data-export-setup](../../../includes/iot-central-data-export-setup.md)]

0 commit comments

Comments
 (0)