|
| 1 | +--- |
| 2 | +title: Manage, update, or uninstall |
| 3 | +description: Use the Azure CLI or Azure portal to manage your Azure IoT Operations instances, including updating and uninstalling. |
| 4 | +author: kgremban |
| 5 | +ms.author: kgremban |
| 6 | +ms.topic: how-to |
| 7 | +ms.custom: devx-track-azurecli |
| 8 | +ms.date: 09/23/2024 |
| 9 | + |
| 10 | +#CustomerIntent: As an OT professional, I want to manage Azure IoT Operations instances. |
| 11 | +--- |
| 12 | + |
| 13 | +# Manage the lifecycle of an Azure IoT Operations instance |
| 14 | + |
| 15 | +[!INCLUDE [public-preview-note](../includes/public-preview-note.md)] |
| 16 | + |
| 17 | +Use the Azure CLI and Azure portal to manage, uninstall, or update Azure IoT Operations instances. |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +* An Azure IoT Operations instance deployed to a cluster. For more information, see [Deploy Azure IoT Operations](./howto-deploy-iot-operations.md). |
| 22 | + |
| 23 | +* Azure CLI installed on your development machine. This scenario requires Azure CLI version 2.64.0 or higher. Use `az --version` to check your version and `az upgrade` to update if necessary. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli). |
| 24 | + |
| 25 | +* The Azure IoT Operations extension for Azure CLI. Use the following command to add the extension or update it to the latest version: |
| 26 | + |
| 27 | + ```azurecli |
| 28 | + az extension add --upgrade --name azure-iot-ops |
| 29 | + ``` |
| 30 | + |
| 31 | +## Manage |
| 32 | + |
| 33 | +After deployment, you can use the Azure CLI and Azure portal to view and manage your Azure IoT Operations instance. |
| 34 | + |
| 35 | +### List instances |
| 36 | + |
| 37 | +#### [Azure CLI](#tab/cli) |
| 38 | + |
| 39 | +Use the `az iot ops list` command to see all of the Azure IoT Operations instances in your subscription or resource group. |
| 40 | + |
| 41 | +The basic command returns all instances in your subscription. |
| 42 | + |
| 43 | +```azurecli |
| 44 | +az iot ops list |
| 45 | +``` |
| 46 | + |
| 47 | +To filter the results by resource group, add the `--resource-group` parameter. |
| 48 | + |
| 49 | +```azurecli |
| 50 | +az iot ops list --resource-group <RESOURCE_GROUP> |
| 51 | +``` |
| 52 | + |
| 53 | +#### [Azure portal](#tab/portal) |
| 54 | + |
| 55 | +1. In the [Azure portal](https://portal.azure.com), search for and select **Azure IoT Operations**. |
| 56 | +1. Use the filters to view Azure IoT Operations instances based on subscription, resource group, and more. |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +### View instance |
| 61 | + |
| 62 | +#### [Azure CLI](#tab/cli) |
| 63 | + |
| 64 | +Use the `az iot ops show` command to view the properties of an instance. |
| 65 | + |
| 66 | +```azurecli |
| 67 | +az iot ops show --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP> |
| 68 | +``` |
| 69 | + |
| 70 | +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. |
| 71 | + |
| 72 | +```azurecli |
| 73 | +az iot ops show --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP> --tree |
| 74 | +``` |
| 75 | + |
| 76 | +The tree view of a deployment looks like the following example: |
| 77 | + |
| 78 | +```bash |
| 79 | +MyCluster |
| 80 | +├── extensions |
| 81 | +│ ├── akvsecretsprovider |
| 82 | +│ ├── azure-iot-operations-ltwgs |
| 83 | +│ └── azure-iot-operations-platform-ltwgs |
| 84 | +└── customLocations |
| 85 | + └── MyCluster-cl |
| 86 | + ├── resourceSyncRules |
| 87 | + └── resources |
| 88 | + ├── MyCluster-ops-init-instance |
| 89 | + └── MyCluster-observability |
| 90 | +``` |
| 91 | + |
| 92 | +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. |
| 93 | + |
| 94 | +#### [Azure portal](#tab/portal) |
| 95 | + |
| 96 | +You can view your Azure IoT Operations instance in the Azure portal. |
| 97 | + |
| 98 | +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**. |
| 99 | + |
| 100 | +1. Select the name of your Azure IoT Operations instance. |
| 101 | + |
| 102 | +1. On the **Overview** page of your instance, the **Arc extensions** table displays the resources that were deployed to your cluster. |
| 103 | + |
| 104 | + :::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"::: |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +### Update instance tags and description |
| 109 | + |
| 110 | +#### [Azure CLI](#tab/cli) |
| 111 | + |
| 112 | +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 |
| 113 | + |
| 114 | +```azurecli |
| 115 | +az iot ops update --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP> --desc "<INSTANCE_DESCRIPTION>" --tags <TAG_NAME>=<TAG-VALUE> <TAG_NAME>=<TAG-VALUE> |
| 116 | +``` |
| 117 | + |
| 118 | +To delete all tags on an instance, set the tags parameter to a null value. For example: |
| 119 | + |
| 120 | +```azurecli |
| 121 | +az iot ops update --name <INSTANCE_NAME> --resource-group --tags "" |
| 122 | +``` |
| 123 | + |
| 124 | +#### [Azure portal](#tab/portal) |
| 125 | + |
| 126 | +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**. |
| 127 | + |
| 128 | +1. Select the name of your Azure IoT Operations instance. |
| 129 | + |
| 130 | +1. On the **Overview** page of your instance, select **Add tags** or **edit** to modify tags on your instance. |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## Uninstall |
| 135 | + |
| 136 | +The Azure CLI and Azure portal offer different options for uninstalling Azure IoT Operations. |
| 137 | + |
| 138 | +The Azure portal steps can delete an Azure IoT Operations instance, but can't affect the related resources in the deployment. If you want to delete the entire deployment, use the Azure CLI. |
| 139 | + |
| 140 | +### [Azure CLI](#tab/cli) |
| 141 | + |
| 142 | +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. |
| 143 | + |
| 144 | +The `delete` command streamlines the redeployment of Azure IoT Operations to the same cluster. It undoes the `create` command so that you can run `create`, `delete`, `create` again and so on without having to rerun `init`. |
| 145 | + |
| 146 | +The `delete` command removes: |
| 147 | + |
| 148 | +* The Azure IoT Operations instance |
| 149 | +* Arc extensions |
| 150 | +* Custom locations |
| 151 | +* Resource sync rules |
| 152 | +* Resources that you can configure in your Azure IoT Operations solution, like assets, MQTT broker, and dataflows. |
| 153 | + |
| 154 | +```azurecli |
| 155 | +az iot ops delete --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP> |
| 156 | +``` |
| 157 | + |
| 158 | +To delete the instance and also remove the Azure IoT Operations dependencies (the output of `init`), add the flag `--include-deps`. |
| 159 | + |
| 160 | +```az iot ops delete --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP> --include-deps |
| 161 | +``` |
| 162 | + |
| 163 | +### [Azure portal](#tab/portal) |
| 164 | + |
| 165 | +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**. |
| 166 | + |
| 167 | +1. Select the name of your Azure IoT Operations instance. |
| 168 | + |
| 169 | +1. On the **Overview** page of your instance, select **Delete** your instance. |
| 170 | + |
| 171 | +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. |
| 172 | + |
| 173 | + :::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."::: |
| 174 | + |
| 175 | +--- |
| 176 | + |
| 177 | +## Update |
| 178 | + |
| 179 | +Currently, there's no support for updating an existing Azure IoT Operations deployment. Instead, uninstall and redeploy a new version of Azure IoT Operations. |
| 180 | + |
| 181 | +1. Use the [az iot ops delete](/cli/azure/iot/ops#az-iot-ops-delete) command to delete the Azure IoT Operations deployment on your cluster. |
| 182 | + |
| 183 | + ```azurecli |
| 184 | + az iot ops delete --cluster <CLUSTER_NAME> --resource-group <RESOURCE_GROUP> |
| 185 | + ``` |
| 186 | + |
| 187 | +1. Update the CLI extension to get the latest Azure IoT Operations version. |
| 188 | + |
| 189 | + ```azurecli |
| 190 | + az extension update --name azure-iot-ops |
| 191 | + ``` |
| 192 | + |
| 193 | +1. Follow the steps in this article to deploy the newest version of Azure IoT Operations to your cluster. |
| 194 | + |
| 195 | + >[!TIP] |
| 196 | + >Add the `--ensure-latest` flag to the `az iot ops init` command to check that the latest Azure IoT Operations CLI version is installed and raise an error if an upgrade is available. |
0 commit comments