Skip to content

Commit fa57e8a

Browse files
committed
final screenshots and cli ref links
1 parent 8f581db commit fa57e8a

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed
0 Bytes
Loading
-55.2 KB
Loading
0 Bytes
Loading

articles/iot-hub/tutorial-connectivity.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: iot-hub
55
author: kgremban
66
ms.author: kgremban
77
ms.custom: [mvc, amqp, mqtt, 'Role: Cloud Development', 'Role: IoT Device', devx-track-js, devx-track-azurecli]
8-
ms.date: 10/26/2021
8+
ms.date: 02/01/2023
99
ms.topic: tutorial
1010
ms.service: iot-hub
1111

@@ -80,15 +80,15 @@ To simulate a device sending telemetry to your IoT hub, run the Node.js simulate
8080

8181
The terminal window displays a success message once it connects to your hub:
8282

83-
:::image type="content" source="{media/tutorial-connectivity/sim-1-connected.png}" alt-text="Screenshot that shows the simulated device connecting.":::
83+
:::image type="content" source="media/tutorial-connectivity/sim-1-connected.png" alt-text="Screenshot that shows the simulated device connecting.":::
8484

8585
You've now successfully authenticated from a device using a device key generated by your IoT hub.
8686

8787
### Reset keys
8888

8989
In this section, you reset the device key and observe the error when the simulated device tries to connect.
9090

91-
1. To reset the primary device key for your device, run the following commands:
91+
1. To reset the primary device key for your device, run the [az iot hub device-identity update](/cli/azure/iot/hub/device-identity#az-iot-hub-device-identity-update) command:
9292

9393
```azurecli-interactive
9494
# Generate a new Base64 encoded key using the current date
@@ -118,7 +118,7 @@ In some scenarios, such as in a cloud protocol gateway or as part of a custom au
118118
> [!NOTE]
119119
> The SimulatedDevice-2.js sample includes examples of generating a SAS token both with and without the SDK.
120120
121-
1. Run the following command to generate a known-good SAS token using the CLI:
121+
1. Run the [az iot hub genereate-sas-token](/cli/azure/iot/hub#az-iot-hub-generate-sas-token) command to generate a known-good SAS token using the CLI:
122122

123123
```azurecli-interactive
124124
az iot hub generate-sas-token --device-id {your_device_id} --hub-name {your_iot_hub_name}
@@ -155,15 +155,15 @@ A device can use any of the following protocols to connect to your IoT hub:
155155

156156
If the outbound port is blocked by a firewall, the device can't connect:
157157

158-
![Port blocked](media/tutorial-connectivity/port-blocked.png)
158+
:::image type="content" source="media/tutorial-connectivity/port-blocked.png" alt-text="Screenshot that shows a connection error when the outbound port is blocked.":::
159159

160160
## Check device-to-cloud connectivity
161161

162162
After a device connects, it can start sending telemetry to your IoT hub. This section shows you how you can verify that the telemetry sent by the device reaches your hub.
163163

164164
### Send device-to-cloud messages
165165

166-
1. Since we reset the connection string for your device in the previous section, use the following command to retrieve the updated connection string:
166+
1. Since we reset the connection string for your device in the previous section, use 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 to retrieve the updated connection string:
167167

168168
```azurecli-interactive
169169
az iot hub device-identity connection-string show --device-id {your_device_id} --output table --hub-name {your_iot_hub_name}
@@ -206,19 +206,19 @@ This section shows how you can make a test direct method call to a device to che
206206
node SimulatedDevice-3.js "{your_device_connection_string}"
207207
```
208208

209-
1. In a separate window, use a CLI command to call a direct method on the device:
209+
1. In a separate window, use the [az iot hub invoke-device-method](/cli/azure/iot/hub#az-iot-hub-invoke-device-method) command to call a direct method on the device:
210210

211211
```azurecli-interactive
212212
az iot hub invoke-device-method --device-id {your_device_id} --method-name TestMethod --timeout 10 --method-payload '{"key":"value"}' --hub-name {your_iot_hub_name}
213213
```
214214

215215
The simulated device prints a message to the console when it receives a direct method call:
216216

217-
![Simulated device receives direct method call](media/tutorial-connectivity/receive-method-call.png)
217+
:::image type="content" source="media/tutorial-connectivity/receive-method-call.png" alt-text="Screenshot that shows the device confirming that the direct method was received.":::
218218

219219
When the simulated device successfully receives the direct method call, it sends an acknowledgment back to the hub:
220220

221-
![Receive direct method acknowledgment](media/tutorial-connectivity/method-acknowledgement.png)
221+
:::image type="content" source="media/tutorial-connectivity/method-acknowledgement.png" alt-text="Screenshot showing that the device returns a direct method acknowledgment.":::
222222

223223
## Check twin synchronization
224224

@@ -232,25 +232,25 @@ The simulated device you use in this section sends reported properties to the hu
232232
node SimulatedDevice-3.js "{your_device_connection_string}"
233233
```
234234

235-
1. In a separate window, run the following CLI command to verify that the hub received the reported properties from the device:
235+
1. In a separate window, run the [az iot hub device-twin show](/cli/azure/iot/hub/device-twin#az-iot-hub-device-twin-show) command to verify that the hub received the reported properties from the device:
236236

237-
```azurecli-interactive
238-
az iot hub device-twin show --device-id {your_device_id} --hub-name {your_iot_hub_name}
239-
```
237+
```azurecli-interactive
238+
az iot hub device-twin show --device-id {your_device_id} --hub-name {your_iot_hub_name}
239+
```
240240

241241
In the output from the command, you can see the **devicelaststarted** property in the reported properties section. This property shows the date and time you last started the simulated device.
242242

243-
![View reported properties](media/tutorial-connectivity/reported-properties.png)
243+
:::image type="content" source="(media/tutorial-connectivity/reported-properties.png" alt-text="Screenshot showing the reported properties of a device.":::
244244

245-
1. To verify that the hub can send desired property values to the device, use the following CLI command:
245+
1. To verify that the hub can send desired property values to the device, use the [az iot hub device-twin update](/cli/azure/iot/hub/device-twin#az-iot-hub-device-twin-update) command:
246246

247247
```azurecli-interactive
248248
az iot hub device-twin update --set properties.desired='{"mydesiredproperty":"propertyvalue"}' --device-id {your_device_id} --hub-name {your_iot_hub_name}
249249
```
250250

251251
The simulated device prints a message when it receives a desired property update from the hub:
252252

253-
![Receive desired properties](media/tutorial-connectivity/desired-properties.png)
253+
:::image type="content" source="media/tutorial-connectivity/desired-properties.png" alt-text="Screenshot that shows the device confirming that the desired properties update was received.":::
254254

255255
In addition to receiving desired property changes as they're made, the simulated device automatically checks for desired properties when it starts up.
256256

0 commit comments

Comments
 (0)