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
title: Deploy an update by using Device Update for Azure IoT Hub | Microsoft Docs
3
-
description: Deploy an update by using Device Update for Azure IoT Hub.
2
+
title: Deploy an update by using Azure Device Update for IoT Hub | Microsoft Docs
3
+
description: Learn how to deploy an update to IoT devices by using Azure Device Update for IoT Hub in the Azure portal or with Azure CLI.
4
4
author: vimeht
5
5
ms.author: vimeht
6
-
ms.date: 10/31/2022
6
+
ms.date: 01/24/2025
7
7
ms.topic: how-to
8
8
ms.service: azure-iot-hub
9
9
ms.custom: devx-track-azurecli
10
10
ms.subservice: device-update
11
11
---
12
12
13
-
# Deploy an update by using Device Update for Azure IoT Hub
13
+
# Deploy an update by using Azure Device Update for IoT Hub
14
14
15
-
Learn how to deploy an update to an IoT device by using Device Update for Azure IoT Hub.
15
+
In this article, you learn how to deploy an update to IoT devices by using Azure Device Update for IoT Hub in the Azure portal or with Azure CLI.
16
16
17
17
## Prerequisites
18
18
19
-
* Access to [an IoT Hub with Device Update for IoT Hub enabled](create-device-update-account.md). We recommend that you use an S1 (Standard) tier or above for your IoT Hub.
20
-
* An [imported update for the provisioned device](import-update.md).
21
-
* An IoT device (or simulator) provisioned for Device Update within IoT Hub.
22
-
* The device is part of at least one default group or [user-created update group](create-update-group.md).
23
-
24
-
# [Azure portal](#tab/portal)
25
-
26
-
Supported browsers:
27
-
28
-
*[Microsoft Edge](https://www.microsoft.com/edge)
29
-
* Google Chrome
30
-
31
-
# [Azure CLI](#tab/cli)
32
-
33
-
An Azure CLI environment:
34
-
35
-
* Use the Bash environment in [Azure Cloud Shell](../cloud-shell/quickstart.md).
36
-
37
-
:::image type="icon" source="~/reusable-content/ce-skilling/azure/media/cloud-shell/launch-cloud-shell-button.png" alt-text="Button to launch the Azure Cloud Shell." border="false" link="https://shell.azure.com":::
38
-
39
-
* Or, if you prefer to run CLI reference commands locally, [install the Azure CLI](/cli/azure/install-azure-cli)
40
-
41
-
1. Sign in to the Azure CLI by using the [az login](/cli/azure/reference-index#az-login) command.
42
-
2. Run [az version](/cli/azure/reference-index#az-version) to find the version and dependent libraries that are installed. To upgrade to the latest version, run [az upgrade](/cli/azure/reference-index#az-upgrade).
43
-
3. When prompted, install Azure CLI extensions on first use. The commands in this article use the **azure-iot** extension. Run `az extension update --name azure-iot` to make sure you're using the latest version of the extension.
44
-
45
-
>[!TIP]
46
-
>The Azure CLI commands in this article use the backslash `\` character for line continuation so that the command arguments are easier to read. This syntax works in Bash environments. If you're running these commands in PowerShell, replace each backslash with a backtick `\``, or remove them entirely.
47
-
48
-
---
19
+
- A Standard (S1) or higher instance of [Azure IoT Hub](/azure/iot-hub/create-hub?tabs=portal) with [Device Update for IoT Hub enabled](create-device-update-account.md).
20
+
- An IoT device or simulator [provisioned for Device Update](device-update-agent-provisioning.md) within the IoT hub. The provisioned device can be a member of a [user-created device group](create-update-group.md) or the default group.
21
+
- An [imported update for the provisioned device](import-update.md).
49
22
50
23
## Deploy the update
51
24
25
+
This section describes how to deploy the update by using the Azure portal or Azure CLI.
26
+
52
27
# [Azure portal](#tab/portal)
53
28
54
29
1. In the [Azure portal](https://portal.azure.com), navigate to your IoT hub.
55
30
56
-
1. Select **Updates**from the navigation menu to open the **Device Update**page of your IoT Hub instance.
31
+
1. Select **Updates**under **Device management**in the left navigation.
57
32
58
-
:::image type="content" source="media/deploy-update/device-update-iot-hub.png" alt-text="Screenshot that shows the Get started with the Device Update for IoT Hub page." lightbox="media/deploy-update/device-update-iot-hub.png":::
33
+
:::image type="content" source="media/deploy-update/device-update-iot-hub.png" alt-text="Screenshot that shows the Get started with the Device Update for IoT Hub page." lightbox="media/deploy-update/device-update-iot-hub.png":::
59
34
60
-
1.Select the **Groups and Deployments** tab at the top of the page. For more information, see [Device groups](device-update-groups.md).
35
+
1.On the **Updates** page, select the **Groups and Deployments** tab and view the [update compliance chart](device-update-compliance.md) and [device group list](device-update-groups.md). You might need to refresh the view to see recently imported updates available for your device group.
61
36
62
-

63
-
64
-
37
+
1. Under **Status** in the group list, select **Deploy** next to **One or more new updates are available for this group**.
38
+
39
+
:::image type="content" source="media/deploy-update/compliance-1.png" alt-text="Screenshot of the compliance view for Groups and Deployments." lightbox="media/deploy-update/compliance-1.png":::
65
40
66
41
1. View the update compliance chart and group list. You should see a new update available for your tag based or default group. You might need to refresh once. For more information, see [Device Update compliance](device-update-compliance.md).
67
42
68
-
1. Select Deploy next to the **one or more updates available** status.
43
+
1. Select **Deploy** next to the **one or more updates available** status.
69
44
70
45
1. From the list on the right, select the desired update to deploy.
71
46
72
-

47
+
:::image type="content" source="media/deploy-update/deploy-3.png" alt-text="Screenshot of the deployment view for selecting updates." lightbox="media/deploy-update/deploy-3.png":::
73
48
74
49
1. Schedule your deployment to start immediately or in the future.
75
50
76
51
> [!TIP]
77
-
> By default, the **Start** date and time is set to Immediately. Be sure to select a different date and time if you want the deployment to begin later.
52
+
> By default, the **Start** date and time is 24 hours from your current time. Be sure to select a different date and time if you want the deployment to begin sooner or later.
78
53
79
54
:::image type="content" source="media/deploy-update/create-deployment.png" alt-text="Screenshot that shows the Create deployment screen" lightbox="media/deploy-update/create-deployment.png":::
80
55
81
56
1. Create an automatic rollback policy if needed. Then select **Create**.
82
57
83
-
1. In the Current Updates tab, you can view the status of your deployment.
58
+
1. In the **Current updates** tab, you can view the status of your deployment.
84
59
85
-

60
+
:::image type="content" source="media/deploy-update/current-updates-4.png" alt-text="A screenshot of the Current updates view." lightbox="media/deploy-update/current-updates-4.png":::
86
61
87
-
1. In the Groups Basics view, the compliance chart shows that the update is now in progress.
62
+
1. In the **Group basics** view, the compliance chart shows that the update is now in progress.
88
63
89
-
1.After your device is successfully updated, you see that your compliance chart and deployment details updated to reflect the same.
64
+
After your device successfully updates, your compliance chart and deployment details update to reflect that status.
90
65
91
66
# [Azure CLI](#tab/cli)
92
67
93
-
68
+
You can use the Bash environment in [Azure Cloud Shell](/azure/cloud-shell/quickstart) to run the following commands. Select **Launch Cloud Shell** to open Cloud Shell, or select the Cloud Shell icon in the top toolbar of the Azure portal.
94
69
95
-
The [`az iot du device group list`](/cli/azure/iot/du/device/group#az-iot-du-device-group-list) to verify the best available update for your group. The command takes the following arguments:
70
+
:::image type="icon" source="~/reusable-content/ce-skilling/azure/media/cloud-shell/launch-cloud-shell-button.png" alt-text="Button to launch the Azure Cloud Shell." border="false" link="https://shell.azure.com":::
96
71
97
-
*`--account`: The Device Update account name.
98
-
*`--instance`: The Device Update instance name.
99
-
*`--group-id`: The device group ID that you're targeting with this deployment. This ID is the value of the **ADUGroup** tag, or `$default` for devices with no tag.
100
-
*`--best-updates`: This flag indicates the command should fetch the best available updates for the device group including a count of how many devices need each update.
101
-
* `--resource-group -g': Device Update account resource group name.
102
-
* '--update-compliance': This flag indicates the command should fetch device group update compliance information such as how many devices are on their latest update, how many need new updates, and how many are in progress on receiving a new update.
72
+
Or, if you prefer, you can run the Azure CLI commands locally:
103
73
104
-
```azurecli
105
-
az iot du device group list \
106
-
--account <Device Update account name> \
107
-
--instance <Device Update instance name>\
108
-
--gid <device group id>\
109
-
--best-updates {false, true}
110
-
```
74
+
1.[Install Azure CLI](/cli/azure/install-azure-cli). Run [az version](/cli/azure/reference-index#az-version) to see the installed Azure CLI version and dependent libraries, and run [az upgrade](/cli/azure/reference-index#az-upgrade) to install the latest version.
75
+
1. Sign in to Azure by running [az login](/cli/azure/reference-index#az-login).
76
+
1. Install the `azure-iot` extension when prompted on first use. To make sure you're using the latest version of the extension, run `az extension update --name azure-iot`.
77
+
78
+
>[!TIP]
79
+
>The Azure CLI commands in this article use the backslash \\ character for line continuation so that the command arguments are easier to read. This syntax works in Bash environments. If you run these commands in PowerShell, replace each backslash with a backtick \`, or remove them entirely.
111
80
112
-
Use [az iot du device deployment create](/cli/azure/iot/du/device/deployment#az-iot-du-device-deployment-create) to create a deployment for a device group.
81
+
### Verify update availability
113
82
114
-
The `device deployment create` command takes the following arguments:
83
+
1. Use the [`az iot du device group list`](/cli/azure/iot/du/device/group#az-iot-du-device-group-list) command to identify your device group.
115
84
116
-
*`--account`: The Device Update account name.
117
-
*`--instance`: The Device Update instance name.
118
-
*`--group-id`: The device group ID that you're targeting with this deployment. This ID is the value of the **ADUGroup** tag, or `$default` for devices with no tag.
119
-
*`--deployment-id`: An ID to identify this deployment.
120
-
*`--update-name`, `--update-provider`, and `--update-version`: These three parameters define the **updateId** object that is a unique identifier for the update that you're using in this deployment.
85
+
```azurecli
86
+
az iot du device group list \
87
+
--account <Device Update account name> \
88
+
--instance <Device Update instance name>\
89
+
```
90
+
91
+
1. Then use [`az iot du device group show`](/cli/azure/iot/du/device/group#az-iot-du-device-group-show) to show the best available update for your group. The command takes the following arguments:
92
+
93
+
-`--account`: The Device Update account name.
94
+
-`--instance`: The Device Update instance name.
95
+
-`--group-id`: The device group ID that you're targeting with this deployment, which is either the value of the `ADUGroup` tag, or `$default` for devices with no tag.
96
+
-`--resource-group`: The Device Update account resource group name.
97
+
-`--best-updates`: Returns the best available updates for the device group, including a count of how many devices need each update.
98
+
-`--update-compliance`: Returns device group update compliance information, such as how many devices are on their latest update, how many need new updates, and how many are currently receiving a new update.
99
+
100
+
To verify the best available update for your group, run the command as follows:
101
+
102
+
```azurecli
103
+
az iot du device group show \
104
+
--account <Device Update account name> \
105
+
--instance <Device Update instance name>\
106
+
--group-id <device group ID>\
107
+
--best-updates
108
+
```
109
+
110
+
### Create the deployment
111
+
112
+
Use [`az iot du device deployment create`](/cli/azure/iot/du/device/deployment#az-iot-du-device-deployment-create) to create a deployment for the device group. The command takes the following arguments:
113
+
114
+
-`--account`: The Device Update account name.
115
+
-`--instance`: The Device Update instance name.
116
+
-`--group-id`: The device group ID that you're targeting with this deployment, which is either the value of the `ADUGroup` tag, or `$default` for devices with no tag.
117
+
-`--deployment-id`: An ID to identify this deployment.
118
+
-`--update-name`, `--update-provider`, and `--update-version`: The parameters that define the `updateId` object, a unique identifier for the update in this deployment.
119
+
120
+
Run the command as follows:
121
121
122
122
```azurecli
123
123
az iot du device deployment create \
124
124
--account <Device Update account name> \
125
125
--instance <Device Update instance name> \
126
-
--group-id <device group id> \
127
-
--deployment-id <deployment id> \
126
+
--group-id <device group ID> \
127
+
--deployment-id <deployment ID> \
128
128
--update-name <update name> \
129
129
--update-provider <update provider> \
130
130
--update-version <update version>
131
131
```
132
132
133
-
Optional arguments allow you to configure the deployment. For the full list, see [Optional parameters](/cli/azure/iot/du/device/deployment#az-iot-du-device-deployment-create-optional-parameters)
133
+
### Use optional arguments
134
134
135
-
If you want to create an automatic rollback policy, add the following parameters:
135
+
Optional arguments allow you to further configure the deployment. For the full list of optional arguments, see [Optional parameters](/cli/azure/iot/du/device/deployment#az-iot-du-device-deployment-create-optional-parameters).
136
136
137
-
*`--failed-count`: The number of failed devices in a deployment that will trigger a rollback.
138
-
*`--failed-percentage`: The percentage of failed devices in a deployment that will trigger a rollback.
139
-
*`--rollback-update-name`, `--rollback-update-provider`, `--rollback-update-version`: The updateID for the update that the device group will use if a rollback is initiated.
137
+
To create an automatic rollback policy, add the following parameters:
138
+
139
+
-`--failed-count`: The number of failed devices in a deployment that triggers a rollback.
140
+
-`--failed-percentage`: The percentage of failed devices in a deployment that triggers a rollback.
141
+
-`--rollback-update-name`, `--rollback-update-provider`, `--rollback-update-version`: The parameters for the update to use if a rollback is initiated.
142
+
143
+
Run the command as follows:
140
144
141
145
```azurecli
142
146
az iot du device deployment create \
143
147
--account <Device Update account name> \
144
148
--instance <Device Update instance name> \
145
-
--group-id <device group id> \
146
-
--deployment-id <deployment id> \
149
+
--group-id <device group ID> \
150
+
--deployment-id <deployment ID> \
147
151
--update-name <update name> \
148
152
--update-provider <update provider> \
149
153
--update-version <update version> \
@@ -154,7 +158,7 @@ az iot du device deployment create \
If you want the deployment to start in the future, use the `--start-time` parameter to provide the target datetime for the deployment.
161
+
To set the deployment start time, use the `--start-time` parameter to provide the target date and time for the deployment, as follows:
158
162
159
163
```azurecli
160
164
az iot du device deployment create \
@@ -170,25 +174,27 @@ az iot du device deployment create \
170
174
171
175
---
172
176
173
-
## Monitor an update deployment
177
+
## Monitor deployment status
174
178
175
179
# [Azure portal](#tab/portal)
176
180
177
-
1.Select the group you deployed to, and go to the **Current updates** or **Deployment history**tab to confirm that the deployment is in progress
181
+
1.On the **Groups and Deployments** tab of the **Updates**page, select the group you deployed to.
178
182
179
-
:::image type="content" source="media/deploy-update/deployments-history.png" alt-text="Screenshot that shows the Deployment history tab." lightbox="media/deploy-update/deployments-history.png":::
183
+
1. On the **Group details** page, go to the **Current deployment** or **Deployment history** tab to confirm that a deployment is in progress.
180
184
181
-
1. Select **Details** next to the deployment you created. Here you can view the deployment details, update details, and target device class details. You can optionally add a friendly name for the device class.
185
+
:::image type="content" source="media/deploy-update/deployments-history.png" alt-text="Screenshot that shows the Deployment history tab." lightbox="media/deploy-update/deployments-history.png":::
182
186
183
-
:::image type="content" source="media/deploy-update/deployment-details.png" alt-text="Screenshot that shows deployment details." lightbox="media/deploy-update/deployment-details.png":::
187
+
1. Select **Details** next to a deployment to view the deployment details, updatedetails, and target device class details. You can optionally add a friendly name for the device class.
184
188
185
189
1. Select **Refresh** to view the latest status details.
186
190
187
-
1. You can go to the group basics view to search the status for a particular device, or filter to view devices that have failed the deployment
191
+
:::image type="content" source="media/deploy-update/deployment-details.png" alt-text="Screenshot that shows deployment details." lightbox="media/deploy-update/deployment-details.png":::
192
+
193
+
Go to the **Group basics** tab of the **Group details** page to search for the status of a particular device, or filter to view devices that failed the deployment.
188
194
189
195
# [Azure CLI](#tab/cli)
190
196
191
-
Use [az iot du device deployment list](/cli/azure/iot/du/device/deployment#az-iot-du-device-deployment-list) to view all deployment for a device group.
197
+
Use [az iot du device deployment list](/cli/azure/iot/du/device/deployment#az-iot-du-device-deployment-list) to view all deployments for a device group.
192
198
193
199
```azurecli
194
200
az iot du device deployment list \
@@ -222,14 +228,12 @@ az iot du device deployment show \
222
228
223
229
## Retry an update deployment
224
230
225
-
If your deployment fails for some reason, you can retry the deployment for failed devices.
231
+
If your deployment fails, you can retry the deployment for failed devices.
226
232
227
233
# [Azure portal](#tab/portal)
228
234
229
235
1. Go to the **Current deployment** tab on the **Group details** screen.
230
236
231
-
:::image type="content" source="media/deploy-update/deployment-active.png" alt-text="Screenshot that shows the deployment as Active." lightbox="media/deploy-update/deployment-active.png":::
232
-
233
237
1. Select **Retry failed devices** and acknowledge the confirmation notification.
234
238
235
239
# [Azure CLI](#tab/cli)
@@ -249,6 +253,7 @@ az iot du device deployment retry \
249
253
250
254
---
251
255
252
-
## Next steps
256
+
## Related content
253
257
254
-
[Troubleshoot common issues](troubleshoot-device-update.md)
0 commit comments