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
description: An include file describing the Azure IoT extension and the az extension commands you can use to list, add, and remove the Azure IoT extension.
4
4
services: iot-hub
5
5
author: SoniaLopezBravo
6
6
ms.service: azure-iot-hub
7
7
ms.topic: include
8
-
ms.date: 03/05/2020
8
+
ms.date: 03/28/2025
9
9
ms.author: sonialopez
10
10
ms.custom: include file
11
11
---
12
12
> [!NOTE]
13
-
> This article uses the newest version of the Azure IoT extension, called `azure-iot`. The legacy version is called `azure-cli-iot-ext`.You should only have one version installed at a time. You can use the command `az extension list` to validate the currently installed extensions.
13
+
> This article uses the newest version of the Azure IoT extension, called `azure-iot`. The legacy version is called `azure-cli-iot-ext`.You should only have one version installed at a time. You can use the command `az extension list` to validate the currently installed extensions.
14
14
>
15
15
> Use `az extension remove --name azure-cli-iot-ext` to remove the legacy version of the extension.
16
16
>
17
17
> Use `az extension add --name azure-iot` to add the new version of the extension.
18
18
>
19
-
> To see what extensions you have installed, use `az extension list`.
19
+
> To see what extensions are currently installed, use `az extension list`.
Copy file name to clipboardExpand all lines: includes/iot-hub-include-create-device-cli.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: SoniaLopezBravo
5
5
ms.author: sonialopez
6
6
ms.service: azure-iot-hub
7
7
ms.topic: include
8
-
ms.date: 01/31/2023
8
+
ms.date: 03/28/2025
9
9
---
10
10
11
11
A device must be registered with your IoT hub before it can connect. In this section, you use Azure CLI to create a device identity.
@@ -16,18 +16,18 @@ To create a device identity:
16
16
17
17
1. Run the [az iot hub device-identity create](/cli/azure/iot/hub/device-identity#az-iot-hub-device-identity-create) command in your CLI shell. This command creates the device identity.
18
18
19
-
*your_iot_hub_name*. Replace this placeholder below with the name you chose for your IoT hub.
19
+
*YourIoTHubName*. Replace this placeholder and the surrounding braces in the following command, using the name you chose for your IoT hub. An IoT hub name must be globally unique in Azure.
20
20
21
21
*myDevice*. You can use this name for the device ID throughout this article, or provide a different device name.
22
22
23
23
```azurecli-interactive
24
-
az iot hub device-identity create --device-id myDevice --hub-name {your_iot_hub_name}
24
+
az iot hub device-identity create --device-id myDevice --hub-name {YourIoTHubName}
25
25
```
26
26
27
27
1. Run the [az iot hub device-identity connection-string show](/cli/azure/iot/hub/device-identity/connection-string#az-iot-hub-device-identity-connection-string-show) command.
28
28
29
29
```azurecli-interactive
30
-
az iot hub device-identity connection-string show --device-id myDevice --hub-name {your_iot_hub_name}
30
+
az iot hub device-identity connection-string show --device-id myDevice --hub-name {YourIoTHubName}
31
31
```
32
32
33
33
The connection string output is in the following format:
@@ -39,4 +39,4 @@ To create a device identity:
39
39
1. Save the connection string in a secure location.
40
40
41
41
> [!NOTE]
42
-
> Keep your CLI app open. You'll use it in later steps.
42
+
> Keep your CLI app open. You use it in later steps.
Copy file name to clipboardExpand all lines: includes/iot-hub-include-create-hub-cli.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: SoniaLopezBravo
5
5
ms.author: sonialopez
6
6
ms.service: azure-iot-hub
7
7
ms.topic: include
8
-
ms.date: 01/31/2023
8
+
ms.date: 03/28/2025
9
9
---
10
10
11
11
In this section, you use Azure CLI to create an IoT hub and a resource group. An Azure resource group is a logical container into which Azure resources are deployed and managed. An IoT hub acts as a central message hub for bi-directional communication between your IoT application and the devices.
@@ -36,8 +36,8 @@ To create an IoT hub and a resource group:
36
36
37
37
1. Run the [az iot hub create](/cli/azure/iot/hub#az-iot-hub-create) command to create an IoT hub. It might take a few minutes to create an IoT hub.
38
38
39
-
*YourIotHubName*. Replace this placeholder and the surrounding braces in the following command, using the name you chose for your IoT hub. An IoT hub name must be globally unique in Azure. Use your IoT hub name in the rest of this quickstart wherever you see the placeholder.
39
+
*YourIoTHubName*. Replace this placeholder and the surrounding braces in the following command, using the name you chose for your IoT hub. An IoT hub name must be globally unique in Azure. Use your IoT hub name in the rest of this quickstart wherever you see the placeholder.
40
40
41
41
```azurecli-interactive
42
-
az iot hub create --resource-group MyResourceGroup --name {your_iot_hub_name}
42
+
az iot hub create --resource-group MyResourceGroup --name {YourIoTHubName}
Copy file name to clipboardExpand all lines: includes/iot-hub-quickstarts-clean-up-resources.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,28 +5,30 @@ services: iot-hub
5
5
author: SoniaLopezBravo
6
6
ms.service: azure-iot-hub
7
7
ms.topic: include
8
-
ms.date: 06/19/2018
8
+
ms.date: 03/28/2025
9
9
ms.author: sonialopez
10
10
ms.custom: include file
11
11
---
12
12
13
13
14
-
If you will be continuing to the next recommended article, you can keep the resources you've already created and reuse them.
14
+
If you're continuing to the next recommended article, you can keep the resources you already created and reuse them.
15
15
16
16
Otherwise, you can delete the Azure resources created in this article to avoid charges.
17
17
18
18
> [!IMPORTANT]
19
-
> Deleting a resource group is irreversible. The resource group and all the resources contained in it are permanently deleted. Make sure that you do not accidentally delete the wrong resource group or resources. If you created the IoT Hub inside an existing resource group that contains resources you want to keep, only delete the IoT Hub resource itself instead of deleting the resource group.
19
+
> Deleting a resource group is irreversible. The resource group and all the resources contained in it are permanently deleted. Make sure that you don't accidentally delete the wrong resource group or resources. If you created the IoT hub inside an existing resource group that contains resources you want to keep, only delete the IoT Hub resource itself instead of deleting the resource group.
20
20
>
21
21
22
22
To delete a resource group by name:
23
23
24
24
1. Sign in to the [Azure portal](https://portal.azure.com) and select **Resource groups**.
25
25
26
-
2. In the **Filter by name** textbox, type the name of the resource group containing your IoT Hub.
26
+
2. In the **Filter for any field** textbox, type the name of the resource group containing your IoT hub.
27
27
28
-
3.To the right of your resource group in the result list, select **...** then **Delete resource group**.
28
+
3.In the result list, select the resource group containing your IoT hub.
4. In the working pane for the resource group, select **Deleteresourcegroup** from the command bar.
31
31
32
-
4. You will be asked to confirm the deletion of the resource group. Type the name of your resource group again to confirm, and then select **Delete**. After a few moments, the resource group and all of its contained resources are deleted.
32
+
:::image type="content" source="./media/iot-hub-quickstarts-clean-up-resources/iot-hub-delete-resource-group.png" alt-text="Screenshot that shows the working pane of a resource group in Azure portal, with the Delete resource group command highlighted in the command bar.":::
33
+
34
+
5. You're asked to confirm the deletion of the resource group. Type the name of your resource group again to confirm, and then select **Delete**. After a few moments, the resource group and all of its contained resources are deleted.
The quickstart uses two pre-written .NET applications:
12
+
The quickstart uses two prewritten .NET applications:
13
13
14
14
* A simulated device application that responds to direct methods called from a service application. To receive the direct method calls, this application connects to a device-specific endpoint on your IoT hub.
15
15
@@ -29,9 +29,9 @@ The quickstart uses two pre-written .NET applications:
29
29
dotnet --version
30
30
```
31
31
32
-
* Clone or download the [Azure IoT C# SDK](https://github.com/Azure/azure-iot-sdk-csharp) from GitHub.
32
+
* Clone or download the [Microsoft Azure IoT SDK for .NET](https://github.com/Azure/azure-iot-sdk-csharp) from GitHub. The sample applications used by this quickstart are included in the SDK.
33
33
34
-
* Make sure that port 8883 is open in your firewall. The device sample in this quickstart uses MQTT protocol, which communicates over port 8883. This port may be blocked in some corporate and educational network environments. For more information and ways to work around this issue, see [Connecting to IoT Hub (MQTT)](../articles/iot/iot-mqtt-connect-to-iot-hub.md#connect-to-iot-hub).
34
+
* Make sure that port 8883 is open in your firewall. The device sample in this quickstart uses MQTT protocol, which communicates over port 8883. This port might be blocked in some corporate and educational network environments. For more information and ways to work around this issue, see the [Connect to IoT Hub](../articles/iot/iot-mqtt-connect-to-iot-hub.md#connect-to-iot-hub) section of [Communicate with an IoT hub using the MQTT protocol](../articles/iot/iot-mqtt-connect-to-iot-hub.md).
@@ -59,9 +59,9 @@ You use this value later in the quickstart.
59
59
60
60
The simulated device application connects to a device-specific endpoint on your IoT hub, sends simulated telemetry, and listens for direct method calls from your hub. In this quickstart, the direct method call from the hub tells the device to change the interval at which it sends telemetry. The simulated device sends an acknowledgment back to your hub after it executes the direct method.
61
61
62
-
1. In a local terminal window, navigate to the root folder of the sample C# project. Then navigate to the **iothub\device\samples\getting started\SimulatedDeviceWithCommand** folder.
62
+
1. In a local terminal window, navigate to the root folder of the SDK. Then, navigate to the **iothub\device\samples\getting started\SimulatedDeviceWithCommand** folder.
63
63
64
-
2. Run the following command to install the required packages for simulated device application:
64
+
2. Run the following command to install the required packages for the simulated device application:
65
65
66
66
```cmd/sh
67
67
dotnet restore
@@ -77,13 +77,13 @@ The simulated device application connects to a device-specific endpoint on your
77
77
78
78
The following screenshot shows the output as the simulated device application sends telemetry to your IoT hub:
79
79
80
-

80
+
:::image type="content" source="./media/quickstart-control-device-dotnet/SimulatedDevice-1.png" alt-text="Screenshot of a terminal window that shows the output of the simulated device application.":::
81
81
82
82
## Call the direct method
83
83
84
84
The service application connects to a service-side endpoint on your IoT Hub. The application makes direct method calls to a device through your IoT hub and listens for acknowledgments. An IoT Hub service application typically runs in the cloud.
85
85
86
-
1. In another local terminal window, navigate to the root folder of the sample C# project. Then navigate to the **iothub\service\samples\getting started\InvokeDeviceMethod** folder.
86
+
1. In another local terminal window, navigate to the root folder of the SDK. Then, navigate to the **iothub\service\samples\getting started\InvokeDeviceMethod** folder.
87
87
88
88
2. In the local terminal window, run the following commands to install the required libraries for the service application:
89
89
@@ -103,8 +103,9 @@ The service application connects to a service-side endpoint on your IoT Hub. The
103
103
104
104
The following screenshot shows the output as the application makes a direct method call to the device and receives an acknowledgment:
105
105
106
-

106
+
:::image type="content" source="./media/quickstart-control-device-dotnet/BackEndApplication.png" alt-text="Screenshot of a terminal window that shows the result of the direct method call from the service application.":::
107
+
108
+
After you run the service application, you see a message in the local terminal window running the simulated device, and the rate at which it sends messages changes:
107
109
108
-
After you run the service application, you see a message in the console window running the simulated device, and the rate at which it sends messages changes:
109
-
110
-

110
+
:::image type="content" source="./media/quickstart-control-device-dotnet/SimulatedDevice-2.png" alt-text="Screenshot of a terminal window that shows the direct message result and updated output from the simulated device application.":::
@@ -34,9 +34,9 @@ This quickstart uses two Java applications:
34
34
mvn --version
35
35
```
36
36
37
-
* Clone or download the [Azure IoT Java samples](https://github.com/Azure-Samples/azure-iot-samples-java/) from GitHub.
37
+
* Clone or download the [Azure IoT Samples for Java](https://github.com/Azure-Samples/azure-iot-samples-java/) from GitHub.
38
38
39
-
* Make sure that port 8883 open in your firewall. The device sample in this quickstart uses MQTT protocol, which communicates over port 8883. This port may be blocked in some corporate and educational network environments. For more information and ways to work around this issue, see [Connecting to IoT Hub (MQTT)](../articles/iot/iot-mqtt-connect-to-iot-hub.md#connect-to-iot-hub).
39
+
* Make sure that port 8883 is open in your firewall. The device sample in this quickstart uses MQTT protocol, which communicates over port 8883. This port might be blocked in some corporate and educational network environments. For more information and ways to work around this issue, see the [Connect to IoT Hub](../articles/iot/iot-mqtt-connect-to-iot-hub.md#connect-to-iot-hub) section of [Communicate with an IoT hub using the MQTT protocol](../articles/iot/iot-mqtt-connect-to-iot-hub.md).
@@ -54,7 +54,7 @@ This quickstart uses two Java applications:
54
54
55
55
You also need a _service connection string_ to enable the back-end application to connect to your IoT hub and retrieve the messages. The following command retrieves the service connection string for your IoT hub:
56
56
57
-
**YourIoTHubName**: Replace this placeholder below with the name you chose for your IoT hub.
57
+
**YourIoTHubName**: Replace this placeholder in the following command with the name you chose for your IoT hub.
58
58
59
59
```azurecli-interactive
60
60
az iot hub connection-string show --policy-name service --hub-name {YourIoTHubName} --output table
@@ -90,7 +90,7 @@ The simulated device application connects to a device-specific endpoint on your
90
90
91
91
The following screenshot shows the output as the simulated device application sends telemetry to your IoT hub:
92
92
93
-

93
+
:::image type="content" source="./media/quickstart-control-device-java/iot-hub-application-send-telemetry-output.png" alt-text="Screenshot of a terminal window that shows the output of the simulated device application.":::
94
94
95
95
## Call the direct method
96
96
@@ -116,8 +116,9 @@ The back-end application connects to a service-side endpoint on your IoT Hub. Th
116
116
117
117
The following screenshot shows the output as the application makes a direct method call to the device and receives an acknowledgment:
118
118
119
-

119
+
:::image type="content" source="./media/quickstart-control-device-java/iot-hub-direct-method-call-output.png" alt-text="Screenshot of a terminal window that shows the result of the direct method call from the service application.":::
120
+
121
+
After you run the back-end application, you see a message in the local terminal window running the simulated device, and the rate at which it sends messages changes:
120
122
121
-
After you run the back-end application, you see a message in the console window running the simulated device, and the rate at which it sends messages changes:
122
-
123
-

123
+
:::image type="content" source="./media/quickstart-control-device-java/iot-hub-sent-message-change-rate.png" alt-text="Screenshot of a terminal window that shows the direct message result and updated output from the simulated device application.":::
0 commit comments