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
Copy file name to clipboardExpand all lines: learn-pr/student-evangelism/deploy-prebuilt-module-edge-device/includes/4-exercise-setup-communication.md
+29-29Lines changed: 29 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,55 +1,55 @@
1
-
This exercise uses Azure CLI in Azure Cloud Shell to issue the required commands.
1
+
This exercise uses the Azure CLI in Azure Cloud Shell to run the required commands.
2
2
3
-
[](../media/cloud-shell.png)
3
+
[](../media/cloud-shell.png)
4
4
5
5
## Install Azure IoT extension
6
6
7
-
You need to add the Azure IoT extension to the Cloud Shell instance Azure CLI.
7
+
Add the Azure IoT extension to the Cloud Shell instance Azure CLI.
8
8
9
9
```
10
10
az extension add --name azure-iot
11
11
```
12
12
13
13
> [!NOTE]
14
-
> 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. To see what extensions you have installed, use`az extension list`.
14
+
> 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. To check which extensions are installed, run`az extension list`.
15
15
>
16
-
> Use`az extension remove --name azure-cli-iot-ext` to remove the legacy version of the extension.
16
+
> Run`az extension remove --name azure-cli-iot-ext` to remove the legacy version of the extension.
17
17
>
18
-
> Use`az extension add --name azure-iot` to add the new version of the extension.
18
+
> Run`az extension add --name azure-iot` to add the new version of the extension.
19
19
20
20
## Create a resource group
21
21
22
-
Create a resource group called "IoTEdgeResources" using the following command:
22
+
Create a resource group named "IoTEdgeResources" by running the following command:
23
23
24
24
```azurecli
25
25
az group create --name IoTEdgeResources --location eastus2
26
26
```
27
27
28
-
The resulting output should be similar to this:
28
+
The output is similar to the following:
29
29
30
-
[](../media/resource-group.png)
30
+
[](../media/resource-group.png)
31
31
32
32
## Create an IoT hub
33
33
34
-
The following code creates a free **F1 tier** hub in the resource group "IoTEdgeResources". Replace `{hub_name}` with a unique name for your IoT Hub.
34
+
The following code creates a free **F1 tier** hub in the resource group "IoTEdgeResources." Replace `{hub_name}` with a unique name for your IoT hub.
35
35
36
36
```azurecli
37
37
az iot hub create --resource-group IoTEdgeResources --name {hub_name} --sku F1 --partition-count 2
38
38
```
39
39
40
40
> [!NOTE]
41
-
> If you get an error because there's already one free hub in your subscription, change the SKU to **S1**. Each subscription can only have one free IoT hub. If you get an error that the IoT hub name isn't available, it means that someone else already has a hub with that name.
41
+
> If you get an error because there's already one free hub in your subscription, change the SKU to **S1**. Each subscription can only have one free IoT hub. If you get an error that the IoT hub name isn't available, it means someone else already has a hub with that name.
42
42
43
43
## Register an IoT Edge device
44
44
45
-
In the Azure Cloud Shell, use the following instructions to create a device named "myEdgeDevice" in your hub.
45
+
In Azure Cloud Shell, follow these steps to create a device named "myEdgeDevice" in your hub.
46
46
47
47
### Create a device identity
48
48
49
-
Since IoT Edge devices behave and can be managed differently compared to typical IoT devices, declare this identity to be for an IoT Edge device with the `--edge-enabled` flag.
49
+
IoT Edge devices behave and are managed differently than typical IoT devices. Use the `--edge-enabled` flag to declare this identity as an IoT Edge device.
50
50
51
51
> [!IMPORTANT]
52
-
> If you get an error about "iothubowner policy keys", make sure that your Cloud Shell is running the latest version of the `azure-iot` extension.
52
+
> If you see an error about "iothubowner policy keys", ensure that your Cloud Shell is running the latest version of the `azure-iot` extension.
53
53
54
54
The following command creates the device identity:
55
55
@@ -67,15 +67,15 @@ To retrieve the connection string for your device, which links your physical dev
67
67
az iot hub device-identity connection-string show --device-id myEdgeDevice --hub-name {hub_name} --output table
Copy the value of the `connectionString` key from the JSON output and save it. This value is the **device connection string**. You use this to configure the IoT Edge runtime in the next section.
74
+
Copy the value of the `connectionString` key from the JSON output and save it. This value is the **device connection string**, which is used to configure the IoT Edge runtime in the next section.
75
75
76
76
## Deploy the IoT Edge device
77
77
78
-
Use the following CLI command to create your IoT Edge device based on the prebuilt [iotedge-vm-deploy](https://github.com/Azure/iotedge-vm-deploy) template. Copy the following command into a text editor, replace the placeholder text with your information, then copy into your bash or Cloud Shell window:
78
+
Use this CLI command to create your IoT Edge device based on the prebuilt [iotedge-vm-deploy](https://github.com/Azure/iotedge-vm-deploy) template. Copy the command into a text editor, replace the placeholder text with your information, and then paste it into your bash or Cloud Shell window:
Make sure that your password(**adminPasswordOrKey**) must be at least 12 characters long and have three of four of the following: lowercase characters, uppercase characters, digits, and special characters.
92
+
Ensure your password(**adminPasswordOrKey**) is at least 12 characters long and includes three of the following: lowercase characters, uppercase characters, digits, and special characters.
93
93
94
-
It may take a few minutes to create and start the new virtual machine. Once the deployment is complete, you should receive JSON-formatted output in the CLI that contains the SSH information to connect to the virtual machine. Copy the value of the **public SSH** entry of the **outputs** section:
94
+
It might take a few minutes to create and start the new virtual machine. After the deployment is complete, you receive JSON-formatted output in the CLI containing the SSH information to connect to the virtual machine. Copy the value of the **public SSH** entry in the **outputs** section:
95
95
96
-
[](../media/public-ssh.png)
96
+
[](../media/public-ssh.png)
97
97
98
98
## View the IoT Edge runtime status
99
99
100
-
Use the following command to connect to your virtual machine. Replace `azureuser` if you used a different username than the one suggested during the deployment of the VM. Replace `{DNSname}` with your machine's DNS name.
100
+
Use this command to connect to your virtual machine. Replace `azureuser` if you used a different username during the VM deployment. Replace `<DNS-name>` with your machine's DNS name.
101
101
102
102
```bash
103
-
ssh {adminusername}@{DNSname}
103
+
ssh <admin-username>@<DNS-name>
104
104
```
105
105
106
106
## Check if the IoT Edge device is configured
107
107
108
-
To verify that the IoT Edge security daemon is running as a system service, we use `iotedge` commands.
108
+
To verify that the IoT Edge security daemon is running as a system service, use `iotedge` commands.
109
109
110
110
> [!IMPORTANT]
111
-
> You need elevated privileges to run iotedge commands.
111
+
> You need elevated privileges to run `iotedge` commands.
112
112
113
-
Run the following commands to test the status of the IoT Edge device:
113
+
Run the following command to check the status of the IoT Edge device:
114
114
115
115
```bash
116
116
sudo systemctl status iotedge
117
117
```
118
118
119
119
The resulting output should be similar to this:
120
120
121
-

121
+

122
122
123
-

123
+

124
124
125
125
**Your IoT Edge device is now configured.** It's ready to run cloud-deployed modules.
126
126
127
-
If you need to troubleshoot the service, retrieve the service logs.
127
+
To troubleshoot the service, retrieve the service logs.
128
128
129
129
```bash
130
130
journalctl -u iotedge
131
131
```
132
132
133
-
View all the modules running on your IoT Edge device. Since the service just started for the first time, you should only see the **edgeAgent** module running. The edgeAgent module runs by default and helps to install and start any additional modules that you deploy to your device.
133
+
View all the modules running on your IoT Edge device. Since the service just started for the first time, only the **edgeAgent** module is running. The edgeAgent module runs by default and helps to install and start any additional modules that you deploy to your device.
Two steps are required to deploy a pre-built module to an edge device:
1
+
To deploy a prebuilt module to an edge device:
2
2
3
3
* Choose an IoT Edge module from a container registry
4
4
* Select the IoT Edge device to receive the module
5
5
6
-
For our scenario, we want to use a module simulating temperature data.
6
+
In this scenario, use a module that simulates temperature data.
7
7
8
8
* Open the Microsoft Artifact Registry and filter for IoT Edge modules
9
9
* Search for the module **Simulated Temperature Sensor**
10
10
* Choose the IoT Edge device to receive this module
11
11
12
-
Use the Azure portal to define the stages to deploy the module.
12
+
Use the Azure portal to define the stages for deploying the module.
13
13
14
14
1.**Add modules**: Enter the URI for the **Simulated Temperature Sensor** module.
15
15
1.**Specify routes**: Routing specifies how messages are passed between modules and IoT Hub. In this case, we select all messages from all modules to go to IoT Hub.
16
16
1.**Review Deployment**: This allows you to preview the deployment manifest JSON file that defines all the modules deployed to your IoT Edge device.
17
17
18
18
## What is a deployment manifest?
19
19
20
-
A deployment manifest is a JSON document that describes which modules to deploy, how data flows between the modules and the module twins' desired properties. The deployment manifest tells your device which modules to install and how to configure them to work together. All IoT Edge devices must be configured with a deployment manifest
20
+
A deployment manifest is a JSON document that describes which modules to deploy, how data flows between the modules, and the module twins' desired properties. The deployment manifest tells your device which modules to install and how to configure them to work together. All IoT Edge devices must be configured with a deployment manifest.
21
21
22
22
> [!NOTE]
23
-
> When you submit a new deployment to an IoT Edge device, **nothing is pushed to your device**. Instead, the device queries IoT Hub regularly for any new instructions. If the device finds an **updated deployment manifest**, it uses the found information to **pull the module images** from the cloud and starts running the modules locally.
23
+
> When you submit a new deployment to an IoT Edge device, **nothing is pushed to your device** Instead, the device regularly queries IoT Hub for any new instructions. If the device finds an **updated deployment manifest**, it uses the information to **pull the module images** from the cloud and starts running the modules locally.
24
24
25
25
## View generated data
26
26
27
-
The "Simulated Temperature Sensor" module creates sample data you can use for testing. The module also generates environment data, i.e., data for the machine and the environment around the machine. For example, this sensor might be in a server room, a factory floor, or a wind turbine. The message includes ambient temperature and humidity, machine temperature and pressure, and a timestamp.
27
+
The "Simulated Temperature Sensor" module generates sample data for testing. The module also generates environment data, such as data for the machine and its surroundings. For example, this sensor could be in a server room, factory floor, or wind turbine. The message includes ambient temperature, humidity, machine temperature, pressure, and a timestamp.
28
28
29
29
## Clean up resources
30
30
31
-
To avoid changes, delete Azure resources as needed, including the device that you created, the resource group. Ensure that the resources deleted won't be needed again.
31
+
To prevent unintended changes, delete Azure resources as needed, including the device you created and the resource group. Make sure the resources you delete aren't needed again.
0 commit comments