Skip to content

Commit 21c1798

Browse files
authored
Merge pull request #281802 from kgremban/aiojuly-cli
CLI updates for 0.6.0
2 parents 4b8c6b8 + 37b8351 commit 21c1798

File tree

5 files changed

+159
-30
lines changed

5 files changed

+159
-30
lines changed

articles/iot-operations/deploy-iot-ops/howto-deploy-iot-operations.md

Lines changed: 159 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: Deploy Azure IoT Operations to a cluster
3-
description: Use the Azure CLI to deploy Azure IoT Operations extensions to an Arc-enabled Kubernetes cluster.
3+
description: Use the Azure CLI to deploy Azure IoT Operations to an Arc-enabled Kubernetes cluster.
44
author: kgremban
55
ms.author: kgremban
66
ms.topic: how-to
77
ms.custom: ignite-2023, devx-track-azurecli
8-
ms.date: 06/06/2024
8+
ms.date: 07/30/2024
99

1010
#CustomerIntent: As an OT professional, I want to deploy Azure IoT Operations to a Kubernetes cluster.
1111
---
@@ -16,6 +16,17 @@ ms.date: 06/06/2024
1616

1717
Deploy Azure IoT Operations Preview to a Kubernetes cluster using the Azure CLI. Once you have Azure IoT Operations deployed, then you can manage and deploy other workloads to your cluster.
1818

19+
* An Azure IoT Operations *deployment* describes all of the components and resources that enable the Azure IoT Operations scenario. These components and resources include:
20+
* An Azure IoT Operations instance
21+
* Arc extensions
22+
* Custom locations
23+
* Resource sync rules
24+
* Resources that you can configure in your Azure IoT Operations solution, like assets, MQTT broker, and dataflows.
25+
26+
* An Azure IoT Operations *instance* is one part of a deployment. It's the parent resource that bundles the suite of services that are defined in [What is Azure IoT Operations Preview?](../overview-iot-operations.md), like MQ, Akri, and OPC UA connector.
27+
28+
In this article, when we talk about deploying Azure IoT Operations we mean the full set of components that make up a *deployment*. Once the deployment exists, you can view, manage, and update the *instance*.
29+
1930
## Prerequisites
2031

2132
Cloud resources:
@@ -24,11 +35,11 @@ Cloud resources:
2435

2536
* Azure access permissions. At a minimum, have **Contributor** permissions in your Azure subscription. Depending on the deployment feature flag status you select, you might also need **Microsoft/Authorization/roleAssignments/write** permissions for the resource group that contains your Arc-enabled Kubernetes cluster. You can make a custom role in Azure role-based access control or assign a built-in role that grants this permission. For more information, see [Azure built-in roles for General](../../role-based-access-control/built-in-roles/general.md).
2637

27-
If you *don't* have role assignment write permissions, you can still deploy Azure IoT Operations by disabling some features. This approach is discussed in more detail in the [Deploy extensions](#deploy-extensions) section of this article.
38+
If you *don't* have role assignment write permissions, you can still deploy Azure IoT Operations by disabling some features. This approach is discussed in more detail in the [Deploy](#deploy) section of this article.
2839

2940
* In the Azure CLI, use the [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create) command to give permissions. For example, `az role assignment create --assignee sp_name --role "Role Based Access Control Administrator" --scope subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup`
3041

31-
* In the Azure portal, you're prompted to restrict access using conditions when you assign privileged admin roles to a user or principal. For this scenario, select the **Allow user to assign all roles** condition in the **Add role assignment** page.
42+
* In the Azure portal, when you assign privileged admin roles to a user or principal, you can restrict access using conditions. For this scenario, select the **Allow user to assign all roles** condition in the **Add role assignment** page.
3243

3344
:::image type="content" source="./media/howto-deploy-iot-operations/add-role-assignment-conditions.png" alt-text="Screenshot that shows assigning users highly privileged role access in the Azure portal.":::
3445

@@ -40,7 +51,7 @@ Cloud resources:
4051

4152
Development resources:
4253

43-
* Azure CLI installed on your development machine. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli). This scenario requires Azure CLI version 2.46.0 or higher. Use `az --version` to check your version and `az upgrade` to update if necessary.
54+
* Azure CLI installed on your development machine. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli). This scenario requires Azure CLI version 2.53.0 or higher. Use `az --version` to check your version and `az upgrade` to update if necessary.
4455

4556
* The Azure IoT Operations extension for Azure CLI. Use the following command to add the extension or update it to the latest version:
4657

@@ -52,7 +63,7 @@ A cluster host:
5263

5364
* An Azure Arc-enabled Kubernetes cluster. If you don't have one, follow the steps in [Prepare your Azure Arc-enabled Kubernetes cluster](./howto-prepare-cluster.md?tabs=wsl-ubuntu).
5465

55-
If you've already deployed Azure IoT Operations to your cluster, uninstall those resources before continuing. For more information, see [Update Azure IoT Operations](#update-azure-iot-operations).
66+
If you deployed Azure IoT Operations to your cluster previously, uninstall those resources before continuing. For more information, see [Update Azure IoT Operations](#update-azure-iot-operations).
5667

5768
Azure IoT Operations should work on any CNCF-conformant kubernetes cluster. Currently, Microsoft only supports K3s on Ubuntu Linux and WSL, or AKS Edge Essentials on Windows. Using Ubuntu in Windows Subsystem for Linux (WSL) is the simplest way to get a Kubernetes cluster for testing.
5869

@@ -62,13 +73,13 @@ A cluster host:
6273
az iot ops verify-host
6374
```
6475

65-
## Deploy extensions
76+
## Deploy
6677

67-
Use the Azure CLI to deploy Azure IoT Operations components to your Arc-enabled Kubernetes cluster.
78+
Use the Azure CLI to deploy Azure IoT Operations to your Arc-enabled Kubernetes cluster.
6879

6980
1. Sign in to Azure CLI interactively with a browser even if you already signed in before. If you don't sign in interactively, you might get an error that says *Your device is required to be managed to access your resource* when you continue to the next step to deploy Azure IoT Operations.
7081

71-
```azurecli-interactive
82+
```azurecli
7283
az login
7384
```
7485

@@ -87,65 +98,183 @@ Use the Azure CLI to deploy Azure IoT Operations components to your Arc-enabled
8798
* Configure a secrets store on your cluster that connects to the key vault.
8899
* Deploy the Azure IoT Operations resources.
89100

90-
```azurecli-interactive
101+
```azurecli
91102
az iot ops init --cluster <CLUSTER_NAME> --resource-group <RESOURCE_GROUP> --kv-id <KEYVAULT_SETTINGS_PROPERTIES_RESOURCE_ID>
92103
```
93104

94-
> [!IMPORTANT]
95-
> By default, the [az iot ops init](/cli/azure/iot/ops#az-iot-ops-init) command doesn't deploy the Data Processor component. To deploy Data Processor, add the `--include-dp` argument.
105+
If you want to name your Azure IoT Operations instance, include the `--name` parameter. Otherwise, a default name is assigned. You can view the `instanceName` parameter in the command output.
96106

97107
If you don't have **Microsoft.Authorization/roleAssignment/write** permissions in the resource group, add the `--disable-rsync-rules` feature flag. This flag disables the resource sync rules on the deployment.
98108

99109
If you want to use an existing service principal and app registration instead of allowing `init` to create new ones, include the `--sp-app-id,` `--sp-object-id`, and `--sp-secret` parameters. For more information, see [Configure service principal and Key Vault manually](howto-manage-secrets.md#configure-service-principal-and-key-vault-manually).
100110

101-
1. After the deployment is complete, you can use [az iot ops check](/cli/azure/iot/ops#az-iot-ops-check) to evaluate IoT Operations service deployment for health, configuration, and usability. The *check* command can help you find problems in your deployment and configuration.
111+
1. While the deployment is in progress, you can watch the resources being applied to your cluster.
112+
113+
* If your terminal supports it, `init` displays the deployment progress.
114+
115+
:::image type="content" source="./media/howto-deploy-iot-operations/view-deployment-terminal.png" alt-text="A screenshot that shows the progress of an Azure IoT Operations deployment in a terminal.":::
116+
117+
Once the **Deploy IoT Operations** phase begins, the text in the terminal becomes a link to view the deployment progress in the Azure portal.
118+
119+
:::image type="content" source="./media/howto-deploy-iot-operations/view-deployment-portal.png" alt-text="A screenshot that shows the progress of an Azure IoT Operations deployment in the Azure portal." lightbox="./media/howto-deploy-iot-operations/view-deployment-portal.png":::
120+
121+
* Otherwise, or if you choose to disable the progress interface with `--no-progress`, you can use kubectl commands to view the pods on your cluster:
122+
123+
```bash
124+
kubectl get pods -n azure-iot-operations
125+
```
126+
127+
It can take several minutes for the deployment to complete. Rerun the `get pods` command to refresh your view.
128+
129+
1. After the deployment is complete, use [az iot ops check](/cli/azure/iot/ops#az-iot-ops-check) to evaluate IoT Operations service deployment for health, configuration, and usability. The *check* command can help you find problems in your deployment and configuration.
102130

103131
```azurecli
104132
az iot ops check
105133
```
106134

107135
You can also check the configurations of topic maps, QoS, and message routes by adding the `--detail-level 2` parameter for a verbose view.
108136

109-
## View resources in your cluster
137+
## Manage Azure IoT Operations
138+
139+
After deployment, you can use the Azure CLI and Azure portal to view and manage your Azure IoT Operations instance.
140+
141+
### List instances
142+
143+
#### [Azure CLI](#tab/cli)
144+
145+
Use the `az iot ops list` command to see all of the Azure IoT Operations instances in your subscription or resource group.
146+
147+
The basic command returns all instances in your subscription.
148+
149+
```azurecli
150+
az iot ops list
151+
```
152+
153+
To filter the results by resource group, add the `--resource-group` parameter.
154+
155+
```azurecli
156+
az iot ops list --resource-group <RESOURCE_GROUP>
157+
```
158+
159+
#### [Azure portal](#tab/portal)
160+
161+
1. In the [Azure portal](https://portal.azure.com), search for and select **Azure IoT Operations**.
162+
1. Use the filters to view Azure IoT Operations instances based on subscription, resource group, and more.
163+
164+
---
165+
166+
### View instance
167+
168+
#### [Azure CLI](#tab/cli)
169+
170+
Use the `az iot ops show` command to view the properties of an instance.
171+
172+
```azurecli
173+
az iot ops show --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP>
174+
```
175+
176+
You can also use the `az iot ops show` command to view the resources in your Azure IoT Operations deployment in the Azure CLI. Add the `--tree` flag to show a tree view of the deployment that includes the specified Azure IoT Operations instance.
110177

111-
While the deployment is in progress, you can watch the resources being applied to your cluster. You can use kubectl commands to observe changes on the cluster or, since the cluster is Arc-enabled, you can use the Azure portal.
178+
```azurecli
179+
az iot ops show --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP> --tree
180+
```
112181

113-
To view the pods on your cluster, run the following command:
182+
The tree view of a deployment looks like the following example:
114183

115184
```bash
116-
kubectl get pods -n azure-iot-operations
185+
MyCluster
186+
├── extensions
187+
│ ├── akvsecretsprovider
188+
│ ├── azure-iot-operations-ltwgs
189+
│ └── azure-iot-operations-platform-ltwgs
190+
└── customLocations
191+
└── MyCluster-cl
192+
├── resourceSyncRules
193+
└── resources
194+
├── MyCluster-ops-init-instance
195+
└── MyCluster-observability
196+
```
197+
198+
You can run `az iot ops check` on your cluster to assess health and configurations of individual Azure IoT Operations components. By default, the command checks MQ but you can [specify the service](/cli/azure/iot/ops#az-iot-ops-check-examples) with `--ops-service` parameter.
199+
200+
#### [Azure portal](#tab/portal)
201+
202+
You can view your Azure IoT Operations instance in the Azure portal.
203+
204+
1. In the [Azure portal](https://portal.azure.com), go to the resource group that contains your Azure IoT Operations instance, or search for and select **Azure IoT Operations**.
205+
206+
1. Select the name of your Azure IoT Operations instance.
207+
208+
1. On the **Overview** page of your instance, select the **Components** tab to view the resources that were deployed to your cluster.
209+
210+
:::image type="content" source="../get-started-end-to-end-sample/media/quickstart-deploy/view-instance.png" alt-text="Screenshot that shows the Azure IoT Operations instance on your Arc-enabled cluster." lightbox="../get-started-end-to-end-sample/media/quickstart-deploy/view-instance.png":::
211+
212+
---
213+
214+
### Update instance tags and description
215+
216+
#### [Azure CLI](#tab/cli)
217+
218+
Use the `az iot ops update` command to edit the tags and description parameters of your Azure IoT Operations instance. The values provided in the `update` command replace any existing tags or description
219+
220+
```azurecli
221+
az iot ops update --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP> --desc "<INSTANCE_DESCRIPTION>" --tags <TAG_NAME>=<TAG-VALUE> <TAG_NAME>=<TAG-VALUE>
117222
```
118223

119-
It can take several minutes for the deployment to complete. Rerun the `get pods` command to refresh your view.
224+
To delete all tags on an instance, set the tags parameter to a null value. For example:
120225

121-
To view your cluster on the Azure portal, use the following steps:
226+
```azurecli
227+
az iot ops update --name <INSTANCE_NAME> --resource-group --tags ""
228+
```
122229

123-
. In the [Azure portal](https://portal.azure.com), go to the resource group that contains your Azure IoT Operations instance.
230+
#### [Azure portal](#tab/portal)
124231

125-
1. From the **Overview** page of the resource group, select the name of your Azure IoT Operations instance.
232+
1. In the [Azure portal](https://portal.azure.com), go to the resource group that contains your Azure IoT Operations instance, or search for and select **Azure IoT Operations**.
126233

127-
1. On the **Overview** page of your instance, select the **Components** tab to view the resources that were deployed to your cluster..
234+
1. Select the name of your Azure IoT Operations instance.
128235

129-
:::image type="content" source="../get-started-end-to-end-sample/media/quickstart-deploy/view-components.png" alt-text="Screenshot that shows the deployed components on your Arc-enabled cluster.":::
236+
1. On the **Overview** page of your instance, select **Add tags** or **edit** to modify tags on your instance.
130237

131-
> [!TIP]
132-
> You can run `az iot ops check` to assess health and configurations of deployed AIO workloads. By default, MQ including cloud connectors are assessed and you can [specifiy the service](/cli/azure/iot/ops#az-iot-ops-check-examples) with `--ops-service --svc`.
238+
---
133239

134240
## Uninstall Azure IoT Operations
135241

136-
Use the [az iot ops delete](/cli/azure/iot/ops#az-iot-ops-delete) command to delete or uninstall Azure IoT Operations from a cluster. The `delete` command evaluates the Azure IoT Operations related resources on the cluster and presents a tree view of the resources to be deleted. The cluster should be online prior to running.
242+
The Azure CLI and Azure portal offer different options for uninstalling Azure IoT Operations.
243+
244+
If you want to delete an entire Azure IoT Operations deployment, use the Azure CLI.
245+
246+
If you want to delete an Azure IoT Operations instance but keep the related resources in the deployment, use the Azure portal.
247+
248+
### [Azure CLI](#tab/cli)
249+
250+
Use the [az iot ops delete](/cli/azure/iot/ops#az-iot-ops-delete) command to delete the entire Azure IoT Operations deployment from a cluster. The `delete` command evaluates the Azure IoT Operations related resources on the cluster and presents a tree view of the resources to be deleted. The cluster should be online when you run this command.
137251

138252
The `delete` command removes:
139253

140-
* Azure IoT Operations extensions
141-
* Azure IoT Operations resource sync rules
142-
* Azure IoT Operations resources
143-
* Associated custom location
254+
* The Azure IoT Operations instance
255+
* Arc extensions
256+
* Custom locations
257+
* Resource sync rules
258+
* Resources that you can configure in your Azure IoT Operations solution, like assets, MQTT broker, and dataflows.
144259

145260
```azurecli
146261
az iot ops delete --cluster <CLUSTER_NAME> --resource-group <RESOURCE_GROUP>
147262
```
148263

264+
### [Azure portal](#tab/portal)
265+
266+
1. In the [Azure portal](https://portal.azure.com), go to the resource group that contains your Azure IoT Operations instance, or search for and select **Azure IoT Operations**.
267+
268+
1. Select the name of your Azure IoT Operations instance.
269+
270+
1. On the **Overview** page of your instance, select **Delete** your instance.
271+
272+
1. Review the list of resources that are and aren't deleted as part of this operation, then type the name of your instance and select **Delete** to confirm.
273+
274+
:::image type="content" source="./media/howto-deploy-iot-operations/delete-instance.png" alt-text="A screenshot that shows deleting an Azure IoT Operations instance in the Azure portal.":::
275+
276+
---
277+
149278
## Update Azure IoT Operations
150279
151280
Currently, there's no support for updating an existing Azure IoT Operations deployment. Instead, uninstall and redeploy a new version of Azure IoT Operations.
59.5 KB
Loading
112 KB
Loading
88 KB
Loading
56.8 KB
Loading

0 commit comments

Comments
 (0)