Skip to content

Commit 5a4bc7b

Browse files
Merge pull request #100562 from ScarlettFalls/end2end-setup
End to End tutorial updates - 02 setup
2 parents 9ebaf7b + 0c3eafa commit 5a4bc7b

File tree

4 files changed

+71
-83
lines changed

4 files changed

+71
-83
lines changed
96.3 KB
Loading
43.7 KB
Loading
168 KB
Loading

articles/iot-edge/tutorial-machine-learning-edge-02-prepare-environment.md

Lines changed: 71 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,23 @@ description: 'Tutorial: Prepare your environment for development and deployment
44
author: kgremban
55
manager: philmea
66
ms.author: kgremban
7-
ms.date: 11/11/2019
7+
ms.date: 1/23/2020
88
ms.topic: tutorial
99
ms.service: iot-edge
1010
services: iot-edge
1111
---
12-
1312
# Tutorial: Set up an environment for machine learning on IoT Edge
1413

1514
> [!NOTE]
1615
> This article is part of a series for a tutorial about using Azure Machine Learning on IoT Edge. If you have arrived at this article directly, we encourage you to begin with the [first article](tutorial-machine-learning-edge-01-intro.md) in the series for the best results.
1716
18-
This article from the end-to-end Azure Machine Learning on IoT Edge tutorial helps you prepare your environment for development and deployment. First, set up a development machine with all the tools you need. Then, create the necessary cloud resources in Azure.
17+
This article helps you prepare your environment for development and deployment. First, set up a development machine with all the tools you need. Then, create the necessary cloud resources in Azure.
1918

20-
## Set up a development machine
19+
## Set up the development VM
2120

2221
This step is typically performed by a cloud developer. Some of the software may also be helpful for a data scientist.
2322

24-
Over the course of this article we perform various developer tasks including coding, compiling, configuring, and deploying IoT Edge modules and IoT devices. For ease of use, we created a PowerShell script that creates an Azure virtual machine with many of the prerequisites already configured. The VM that we create needs to be able to handle [nested virtualization](https://docs.microsoft.com/azure/virtual-machines/windows/nested-virtualization), which is why we chose a [Standard_D8s_v3](../virtual-machines/windows/sizes-general.md#dsv3-series-1) machine size.
23+
We created a PowerShell script that creates an Azure virtual machine with many of the prerequisites already configured. The VM that we create needs to be able to handle [nested virtualization](https://docs.microsoft.com/azure/virtual-machines/windows/nested-virtualization), which is why we chose a [Standard_D8s_v3](../virtual-machines/windows/sizes-general.md#dsv3-series-1) machine size.
2524

2625
The development VM will be set up with:
2726

@@ -45,102 +44,95 @@ The developer VM is not strictly necessary – all the development tools can be
4544

4645
It takes about 30 minutes to create and configure the virtual machine.
4746

48-
### Get the script
49-
50-
Clone or download the PowerShell script from the [Machine Learning and IoT Edge](https://github.com/Azure-Samples/IoTEdgeAndMlSample) sample repository.
51-
52-
### Create an Azure virtual machine
47+
1. Clone or download the [Machine Learning and IoT Edge](https://github.com/Azure-Samples/IoTEdgeAndMlSample) sample repository to your local computer.
5348

54-
The DevVM directory contains the files needed to create an Azure virtual machine appropriate for completing this tutorial.
55-
56-
1. Open Powershell as an administrator and navigate to the directory where you downloaded the code. We will refer to the root directory for your source as `<srcdir>`.
49+
1. Open Powershell as an administrator and navigate to the **\IoTEdgeAndMlSample\DevVM** directory located under the root directory where you downloaded the code. We will refer to the root directory for your source as `srcdir`.
5750

5851
```powershell
59-
cd <srcdir>\IoTEdgeAndMlSample\DevVM
52+
cd c:\srcdir\IoTEdgeAndMlSample\DevVM
6053
```
6154
62-
2. Run the following command to allow execution of scripts. Choose **Yes to All** when prompted.
55+
The DevVM directory contains the files needed to create an Azure virtual machine appropriate for completing this tutorial.
56+
57+
1. Run the following command to allow execution of scripts. Choose **Yes to All** when prompted.
6358
6459
```powershell
6560
Set-ExecutionPolicy Bypass -Scope Process
6661
```
6762
68-
3. Run Create-AzureDevVM.ps1 from this directory.
63+
1. Run Create-AzureDevVM.ps1.
6964
7065
```powershell
7166
.\Create-AzureDevVm.ps1
7267
```
7368
74-
* When prompted, provide the following information:
75-
* **Azure Subscription ID**: Your subscription ID, which can be found in the Azure portal
76-
* **Resource Group Name**: The name of a new or existing resource group in Azure
77-
* **Location**: Choose an Azure location where the virtual machine will be created. For example, westus2 or northeurope. For more information, see [Azure locations](https://azure.microsoft.com/global-infrastructure/locations/).
78-
* **AdminUsername**: Provide a memorable name for the admin account you want to create and use on the virtual machine.
79-
* **AdminPassword**: Set a password for the admin account on the virtual machine.
69+
When prompted, provide the following information:
8070
81-
* If you do not have Azure PowerShell installed, the script will install [Azure PowerShell Az module](https://docs.microsoft.com/powershell/azure/new-azureps-module-az?view=azps-1.1.0)
71+
* **Azure Subscription ID**: Your subscription ID, which can be found in [Azure Subscriptions](https://ms.portal.azure.com/#blade/Microsoft_Azure_Billing/SubscriptionsBlade) in portal.
72+
* **Resource Group Name**: The name of a new or existing resource group in Azure.
73+
* **Location**: Choose an Azure location where the virtual machine will be created. For example, 'West US 2' or 'North Europe'. For more information, see [Azure locations](https://azure.microsoft.com/global-infrastructure/locations/).
74+
* **Username**: Provide a memorable name for the administrator account for the VM.
75+
* **Password**: Set a password for the administrator account for the VM.
8276
83-
* You will be prompted to sign in to Azure.
84-
85-
* The script confirms the information for the creation of your VM. Press `y` or `Enter` to continue.
77+
The script runs for several minutes as it executes the following steps:
8678
87-
The script runs for several minutes as it executes the following steps:
79+
1. Installs the [Azure PowerShell Az module](https://docs.microsoft.com/powershell/azure/new-azureps-module-az?view=azps-1.1.0).
80+
1. Prompts you to sign in to Azure.
81+
1. Confirms the information for the creation of your VM. Press **y** or **Enter** to continue.
82+
1. Creates the resource group if it does not exist.
83+
1. Deploys the virtual machine.
84+
1. Enables Hyper-V on the VM.
85+
1. Installs software need for development and clone the sample repository.
86+
1. Restarts the VM.
87+
1. Creates an RDP file on your desktop for connecting to the VM.
8888
89-
* Create the resource group if it does not exist
90-
* Deploy the virtual machine
91-
* Enable Hyper-V on the VM
92-
* Install software need for development and clone the sample repository
93-
* Restart the VM
94-
* Create an RDP file on your desktop for connecting to the VM
89+
If you are prompted for the name of the VM to restart it, you can copy its name from the script output. The output also shows the path to the RDP file for connecting to the VM.
9590
9691
### Set auto-shutdown schedule
9792
98-
To help you reduce cost, the VM has been created with an automatic shutdown schedule that is set to 1900 PST. You may need to update this timing depending on your location and schedule. To update the shutdown
99-
schedule:
93+
To help you reduce cost, the development VM has been created with an automatic shutdown schedule that is set to 1900 PST. You may need to update this setting depending on your location and schedule. To update the shutdown schedule:
10094
101-
1. Sign in to the [Azure portal](https://portal.azure.com).
95+
1. In the Azure portal, navigate to the VM that the script created.
10296
103-
2. Navigate to your virtual machine in the resource group that you provided in the previous section.
97+
1. From the left pane menu, under **Operations**, select **Auto-shutdown**.
10498
105-
3. Select **Auto-shutdown** on the side navigator.
99+
1. Adjust the **Scheduled shutdown** and **Time zone** as desired and select **Save**.
106100
107-
4. Enter a new shutdown time in **Scheduled shutdown** or change the **Time zone** then click **Save**.
108-
109-
### Connect and configure development machine
101+
## Connect to the development VM
110102
111103
Now that we have created a VM we need to finish installing the software needed to complete the tutorial.
112104
113-
#### Start a remote desktop session
114-
115-
1. The VM creation script created an RDP file on your desktop.
105+
1. Double-click on the RDP file that the script created on your desktop.
116106
117-
2. Double-click on the file with the name **\<Azure VM name\>.rdp**.
107+
1. You will be presented with a dialog saying the publisher of the remote connection is unknown. This is acceptable, so select **Connect**.
118108
119-
3. You will be presented with a dialog saying the publisher of the remote connection is unknown. Click the **Don’t ask me again for connections to this computer** checkbox then select **Connect**.
109+
1. Provide the administrator password that you provided to create the VM and click **OK**.
120110
121-
4. When prompted, provide the AdminPassword that you used when running the script to set up the VM and click **OK**.
111+
1. You will be prompted to accept the certificate for the VM. Select **Yes**.
122112
123-
5. You will be prompted to accept the certificate for the VM. Select **Don’t ask me again for connections to this computer** and choose **Yes**.
124-
125-
#### Install Visual Studio Code extensions
113+
## Install Visual Studio Code extensions
126114
127115
Now that you have connected to the development machine, add some useful extensions to Visual Studio Code to make the development experience easier.
128116
129-
1. In a PowerShell window, navigate to **C:\\source\\IoTEdgeAndMlSample\\DevVM**.
117+
1. Connect to the development VM, open a PowerShell window, and navigate to the **C:\source\IoTEdgeAndMlSample\DevVM** directory. This directory was created by the script that created the VM.
130118
131-
2. Allow scripts to be executed on the virtual machine by typing.
119+
```powershell
120+
cd C:\source\IoTEdgeAndMlSample\DevVM
121+
```
122+
123+
1. Run the following command to allow execution of scripts. Choose **Yes to All** when prompted.
132124
133125
```powershell
134-
Set-ExecutionPolicy Bypass -Scope CurrentUser -Force
126+
Set-ExecutionPolicy Bypass -Scope Process
135127
```
136128
137-
3. Run the script.
129+
1. Run the Visual Studio Code extensions script.
138130
139131
```powershell
140132
.\Enable-CodeExtensions.ps1
141133
```
142134
143-
4. The script will run for a few minutes installing VS code extensions:
135+
1. The script will run for a few minutes installing VS code extensions:
144136
145137
* Azure IoT Tools
146138
* Python
@@ -152,19 +144,15 @@ Now that you have connected to the development machine, add some useful extensio
152144
153145
These steps are typically performed by a cloud developer.
154146
155-
Azure IoT Hub is the heart of any IoT application. It handles secure communication between IoT devices and the cloud. It is the main coordination point for the operation of the IoT Edge machine learning solution.
147+
Azure IoT Hub is the heart of any IoT application as it handles secure communication between IoT devices and the cloud. It is the main coordination point for the operation of the IoT Edge machine learning solution.
156148
157-
* IoT Hub uses routes to direct incoming data from IoT devices to other downstream services. We will take advantage of IoT Hub routes to send device data to Azure Storage where it can be consumed by Azure Machine Learning to train our remaining useful life (RUL) classifier.
149+
* IoT Hub uses routes to direct incoming data from IoT devices to other downstream services. We will take advantage of IoT Hub routes to send device data to Azure Storage. In Azure Storage, the device data is consumed by Azure Machine Learning to train our remaining useful life (RUL) classifier.
158150
159151
* Later in the tutorial, we will use IoT Hub to configure and manage our Azure IoT Edge device.
160152
161-
In this section, you use a script to create an Azure IoT hub and an Azure Storage account. Then, you configure a route that forwards data received by the hub to an Azure Storage Blob container using the Azure portal. These steps take about 10 minutes to complete.
153+
In this section, you use a script to create an Azure IoT hub and an Azure Storage account. Then in the Azure portal, you configure a route that forwards data received by the hub to an Azure Storage container. These steps take about 10 minutes to complete.
162154
163-
### Create cloud resources
164-
165-
1. On your development machine, open a PowerShell window.
166-
167-
1. Change to the IoTHub directory.
155+
1. Connect to the development VM, open a PowerShell window, and navigate to the **IoTHub** directory.
168156
169157
```powershell
170158
cd C:\source\IoTEdgeAndMlSample\IoTHub
@@ -173,50 +161,50 @@ In this section, you use a script to create an Azure IoT hub and an Azure Storag
173161
1. Run the creation script. Use the same values for subscription ID, location, and resource group as you did when creating the development VM.
174162
175163
```powershell
176-
.\New-HubAndStorage.ps1 -SubscriptionId <subscription id> -Location
177-
<location> -ResourceGroupName <resource group>
164+
.\New-HubAndStorage.ps1 -SubscriptionId <subscription id> -Location <location> -ResourceGroupName <resource group>
178165
```
179166
180167
* You will be prompted to sign in to Azure.
181-
* The script confirms the information for the creation of your Hub and Storage account. Press `y` or `Enter` to continue.
168+
* The script confirms the information for the creation of your Hub and Storage account. Press **y** or **Enter** to continue.
182169
183-
The script takes about two minutes to run. Once complete, the script outputs the name of the hub and the storage account.
170+
The script takes about two minutes to run. Once complete, the script outputs the name of the IoT hub and the storage account.
184171
185-
### Review route to storage in IoT Hub
172+
## Review route to storage in IoT Hub
186173
187-
As part of creating the IoT hub, the script that we ran in the previous section also created a custom endpoint and a route. IoT Hub routes consist of a query expression and an endpoint. If a message matches the expression, the data is sent along the route to the associated endpoint. Endpoints can be Event Hubs, Service Bus Queues, and Topics. In this case, the endpoint is a Blob container in a storage account. Let’s use the Azure portal to review the route created by our script.
174+
As part of creating the IoT hub, the script that we ran in the previous section also created a custom endpoint and a route. IoT Hub routes consist of a query expression and an endpoint. If a message matches the expression, the data is sent along the route to the associated endpoint. Endpoints can be Event Hubs, Service Bus Queues, and Topics. In this case, the endpoint is a blob container in a storage account. Let’s use the Azure portal to review the route created by our script.
188175
189-
1. Open the [Azure portal](https://portal.azure.com).
176+
1. Open the [Azure portal](https://portal.azure.com) and go to the resource group you're using for this tutorial.
190177
191-
1. Choose all services from the left navigator, type IoT in the search box, and select **IoT Hub**.
178+
1. In the list of resources, select the IoT Hub that the script created. It will have a name ending with random characters such as `IotEdgeAndMlHub-jrujej6de6i7w`.
192179
193-
1. Choose the IoT Hub created in the previous step.
180+
1. From the left pane menu, under **Messaging**, select **Message routing**.
194181
195-
1. In the IoT Hub side navigator, choose **Message routing**.
182+
1. On the **Message routing** page, select the **Custom endpoints** tab.
196183
197-
1. The message routing page has two tabs, **Routes** and **Custom endpoints**. Select the **Custom endpoints** tab.
184+
1. Expand the **Storage** section:
198185
199-
1. Under **Blob storage**, select **turbofanDeviceStorage**.
186+
![Verify turbofandevicestorage is in the custom endpoints list](media/tutorial-machine-learning-edge-02-prepare-environment/custom-endpoints.png)
200187
201-
1. Note that this endpoint points to a blob container called **devicedata** in the storage account created in the last step, which is named **iotedgeandml\<unique suffix\>**.
188+
We see **turbofandevicestorage** is in the custom endpoints list. Note the following characteristics about this endpoint:
202189
203-
1. Also note the **Blob file name format** has been changed from the default format to instead place the partition as the last element in the name. We find this format is more convenient for the file operations we will do with Azure Notebooks later in the tutorial.
204-
205-
1. Close the endpoint details blade to return to the **Message routing** page.
190+
* It points to the blob storage container you created named `devicedata` as indicated by **Container name**.
191+
* Its **Filename format** has partition as the last element in the name. We find this format is more convenient for the file operations we will do with Azure Notebooks later in the tutorial.
206192
207193
1. Select the **Routes** tab.
208194
209195
1. Select the route named **turbofanDeviceDataToStorage**.
210196
211-
1. Note that the route’s endpoint is the **turbofanDeviceStorage** custom endpoint.
197+
1. On the **Routes details** page, note that the route’s endpoint is the **turbofanDeviceStorage** endpoint.
198+
199+
![Review details about the turbofanDeviceDataToStorage route](media/tutorial-machine-learning-edge-02-prepare-environment/route-details.png)
212200
213-
1. Look at the routing query, which is set to **true**. This means that all device telemetry messages will match this route and therefore all messages will be sent to the **turbofanDeviceStorage** endpoint.
201+
1. Look at the **Routing query**, which is set to **true**. This setting means that all device telemetry messages will match this route; and therefore all messages will be sent to the **turbofanDeviceStorage** endpoint.
214202
215-
1. Close the route details.
203+
1. Since no edits were made, just close this page.
216204
217205
## Next steps
218206
219-
In this article, we created an IoT Hub and configured a route to an Azure Storage account. In the next article, we will send data from a set of simulated devices through the IoT Hub into the storage account. Later in the tutorial, after we have configured our IoT Edge device and modules, we will revisit routes and look a little more at the routing query.
207+
In this article, we created an IoT Hub and configured a route to an Azure Storage account. Next, we will send data from a set of simulated devices through the IoT Hub into the storage account. Later in the tutorial, after we have configured our IoT Edge device and modules, we will revisit routes and look a little more at the routing query.
220208
221209
For more information about the steps covered in this portion of the Machine Learning on IoT Edge tutorial, see:
222210

0 commit comments

Comments
 (0)