Skip to content

Commit 7de6764

Browse files
authored
Merge pull request #78824 from kgremban/jun3-proxyissue
Improve clarity in proxy article
2 parents 1cfd899 + cea75fb commit 7de6764

File tree

1 file changed

+70
-39
lines changed

1 file changed

+70
-39
lines changed

articles/iot-edge/how-to-configure-proxy-support.md

Lines changed: 70 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: How to configure the Azure IoT Edge runtime and any internet-facing
44
author: kgremban
55
manager:
66
ms.author: kgremban
7-
ms.date: 03/20/2019
7+
ms.date: 06/05/2019
88
ms.topic: conceptual
99
ms.service: iot-edge
1010
services: iot-edge
@@ -15,16 +15,35 @@ ms.custom: seodec18
1515

1616
IoT Edge devices send HTTPS requests to communicate with IoT Hub. If your device is connected to a network that uses a proxy server, you need to configure the IoT Edge runtime to communicate through the server. Proxy servers can also affect individual IoT Edge modules if they make HTTP or HTTPS requests that aren't routed through the IoT Edge hub.
1717

18-
Configuring an IoT Edge device to work with a proxy server follows these basic steps:
18+
This article walks through the following four steps to configure and then manage an IoT Edge device behind a proxy server:
1919

20-
1. Install the IoT Edge runtime on your device.
21-
2. Configure the Docker daemon and the IoT Edge daemon on your device to use the proxy server.
22-
3. Configure the edgeAgent properties in the config.yaml file on your device.
23-
4. Set environment variables for the IoT Edge runtime and other IoT Edge modules in the deployment manifest.
20+
1. **Install the IoT Edge runtime on your device.**
21+
22+
The IoT Edge installation scripts pull packages and files from the internet, so your device needs to communicate through the proxy server to make those requests. For detailed steps, see the [Install the runtime through a proxy](#install-the-runtime-through-a-proxy) section of this article. For Windows devices, the installation script also provides an [Offline installation](how-to-install-iot-edge-windows.md#offline-installation) option.
23+
24+
This step is a one-time process performed on the IoT Edge device when you first set it up. The same connections are also required when you update the IoT Edge runtime.
25+
26+
2. **Configure the Docker daemon and the IoT Edge daemon on your device.**
27+
28+
IoT Edge uses two daemons on the device, both of which need to make web requests through the proxy server. The IoT Edge daemon is responsible for communications with IoT Hub. The Moby daemon is responsible for container management, so communicates with container registries. For detailed steps, see the [Configure the daemons](#configure-the-daemons) section of this article.
29+
30+
This step is a one-time process performed on the IoT Edge device when you first set it up.
31+
32+
3. **Configure the IoT Edge agent properties in the config.yaml file on your device.**
33+
34+
The IoT Edge daemon starts the edgeAgent module initially, but then the edgeAgent module is responsible for retrieving the deployment manifest from IoT Hub and starting all the other modules. For the IoT Edge agent to make the initial connection to IoT Hub, configure the edgeAgent module environment variables manually on the device itself. After the initial connection, you can configure the edgeAgent module remotely. For detailed steps, see the [Configure the IoT Edge agent](#configure-the-iot-edge-agent) section of this article.
35+
36+
This step is a one-time process performed on the IoT Edge device when you first set it up.
37+
38+
4. **For all future module deployments, set environment variables for any module communicating through the proxy.**
39+
40+
Once your IoT Edge device is set up and connected to IoT Hub through the proxy server, you need to maintain the connection in all future module deployments. For detailed steps, see the [Configure deployment manifests](#configure-deployment-manifests) section of this article.
41+
42+
This step is an ongoing process performed remotely so that every new module or deployment update maintains the device's ability to communicate through the proxy server.
2443

2544
## Know your proxy URL
2645

27-
To configure both the Docker daemon and IoT Edge on your device, you need to know your proxy URL.
46+
Before you begin any of the steps in this article, you need to know your proxy URL.
2847

2948
Proxy URLs take the following format: **protocol**://**proxy_host**:**proxy_port**.
3049

@@ -34,11 +53,19 @@ Proxy URLs take the following format: **protocol**://**proxy_host**:**proxy_port
3453

3554
* The **proxy_port** is the network port at which the proxy responds to network traffic.
3655

37-
## Install the runtime
56+
## Install the runtime through a proxy
57+
58+
Whether your IoT Edge device runs on Windows or Linux, you need to access the installation packages through the proxy server. Depending on your operating system, follow the steps to install the IoT Edge runtime through a proxy server.
59+
60+
### Linux
3861

3962
If you're installing the IoT Edge runtime on a Linux device, configure the package manager to go through your proxy server to access the installation package. For example, [Set up apt-get to use a http-proxy](https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy). Once your package manager is configured, follow the instructions in [Install Azure IoT Edge runtime on Linux (ARM32v7/armhf)](how-to-install-iot-edge-linux-arm.md) or [Install the Azure IoT Edge runtime on Linux (x64)](how-to-install-iot-edge-linux.md) as usual.
4063

41-
If you're installing the IoT Edge runtime on a Windows device, you need to go through the proxy server twice. The first connection is to download the installer script file, and the second connection is during the installation to download the necessary components. You can configure proxy information in Windows settings, or include your proxy information directly in the PowerShell commands. The following steps demonstrate an example of a windows installation using the `-proxy` argument:
64+
### Windows
65+
66+
If you're installing the IoT Edge runtime on a Windows device, you need to go through the proxy server twice. The first connection downloads the installer script file, and the second connection is during the installation to download the necessary components. You can configure proxy information in Windows settings, or include your proxy information directly in the PowerShell commands.
67+
68+
The following steps demonstrate an example of a windows installation using the `-proxy` argument:
4269

4370
1. The Invoke-WebRequest command needs proxy information to access the installer script. Then the Deploy-IoTEdge command needs the proxy information to download the installation files.
4471

@@ -59,13 +86,13 @@ $proxyCredential = (Get-Credential).GetNetworkCredential()
5986
Deploy-IoTEdge -InvokeWebRequestParameters @{ '-Proxy' = '<proxy URL>'; '-ProxyCredential' = $proxyCredential }
6087
```
6188

62-
For more information about proxy parameters, see [Invoke-WebRequest](https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest). For more information about Windows installation options, see [Install Azure IoT Edge runtime on Windows](how-to-install-iot-edge-windows.md).
63-
64-
Once the IoT Edge runtime is installed, use the following section to configure it with your proxy information.
89+
For more information about proxy parameters, see [Invoke-WebRequest](https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest). For more information about Windows installation options, including offline installation, see [Install Azure IoT Edge runtime on Windows](how-to-install-iot-edge-windows.md).
6590

6691
## Configure the daemons
6792

68-
The Moby and IoT Edge daemons running on your IoT Edge device need to be configured to use the proxy server. The Moby daemon makes web requests to pull container images from container registries. The IoT Edge daemon makes web requests to communicate with IoT Hub.
93+
IoT Edge relies on two daemons running on the IoT Edge device. The Moby daemon makes web requests to pull container images from container registries. The IoT Edge daemon makes web requests to communicate with IoT Hub.
94+
95+
Both the Moby and the IoT Edge daemons need to be configured to use the proxy server for ongoing device functionality. This step takes place on the IoT Edge device during initial device setup.
6996

7097
### Moby daemon
7198

@@ -80,7 +107,9 @@ Choose the article that applies to your IoT Edge device operating system:
80107

81108
### IoT Edge daemon
82109

83-
The IoT Edge daemon is configured in a similar manner to the Moby daemon. All the requests that IoT Edge sends to IoT Hub use HTTPS. Use the following steps to set an environment variable for the service, based on your operating system.
110+
The IoT Edge daemon is configured in a similar manner to the Moby daemon. Use the following steps to set an environment variable for the service, based on your operating system.
111+
112+
The IoT Edge daemon always uses HTTPS to send requests to IoT Hub.
84113

85114
#### Linux
86115

@@ -133,47 +162,49 @@ Restart-Service iotedge
133162

134163
The IoT Edge agent is the first module to start on any IoT Edge device. It's started for the first time based on the information in the IoT Edge config.yaml file. The IoT Edge agent then connects to IoT Hub to retrieve deployment manifests, which declare what other modules should be deployed on the device.
135164

136-
Open the config.yaml file on your IoT Edge device. On Linux systems, this file is located at **/etc/iotedge/config.yaml**. On Windows systems, this file is located at **C:\ProgramData\iotedge\config.yaml**. The configuration file is protected, so you need administrative privileges to access it. On Linux systems, that means using the `sudo` command before opening the file in your preferred text editor. On Windows, that means opening a text editor like Notepad to run as administrator and then opening the file.
165+
This step takes place once on the IoT Edge device during initial device setup.
137166

138-
In the config.yaml file, find the **Edge Agent module spec** section. The IoT Edge agent definition includes an **env** parameter where you can add environment variables.
167+
1. Open the config.yaml file on your IoT Edge device. On Linux systems, this file is located at **/etc/iotedge/config.yaml**. On Windows systems, this file is located at **C:\ProgramData\iotedge\config.yaml**. The configuration file is protected, so you need administrative privileges to access it. On Linux systems, use the `sudo` command before opening the file in your preferred text editor. On Windows, open a text editor like Notepad as administrator and then open the file.
139168

140-
<!--
141-
![edgeAgent definition](./media/how-to-configure-proxy-support/edgeagent-unedited.png)
142-
-->
169+
2. In the config.yaml file, find the **Edge Agent module spec** section. The IoT Edge agent definition includes an **env** parameter where you can add environment variables.
143170

144-
Remove the curly brackets that are placeholders for the env parameter, and add the new variable on a new line. Remember that indents in YAML are two spaces.
171+
3. Remove the curly brackets that are placeholders for the env parameter, and add the new variable on a new line. Remember that indents in YAML are two spaces.
145172

146-
```yaml
147-
https_proxy: "<proxy URL>"
148-
```
173+
```yaml
174+
https_proxy: "<proxy URL>"
175+
```
149176
150-
The IoT Edge runtime uses AMQP by default to talk to IoT Hub. Some proxy servers block AMQP ports. If that's the case, then you also need to configure edgeAgent to use AMQP over WebSocket. Add a second environment variable.
177+
4. The IoT Edge runtime uses AMQP by default to talk to IoT Hub. Some proxy servers block AMQP ports. If that's the case, then you also need to configure edgeAgent to use AMQP over WebSocket. Add a second environment variable.
151178
152-
```yaml
153-
UpstreamProtocol: "AmqpWs"
154-
```
179+
```yaml
180+
UpstreamProtocol: "AmqpWs"
181+
```
155182
156-
![edgeAgent definition with environment variables](./media/how-to-configure-proxy-support/edgeagent-edited.png)
183+
![edgeAgent definition with environment variables](./media/how-to-configure-proxy-support/edgeagent-edited.png)
157184
158-
Save the changes to config.yaml and close the editor. Restart IoT Edge for the changes to take effect.
185+
5. Save the changes to config.yaml and close the editor. Restart IoT Edge for the changes to take effect.
159186
160-
* Linux:
187+
* Linux:
161188
162-
```bash
163-
sudo systemctl restart iotedge
164-
```
189+
```bash
190+
sudo systemctl restart iotedge
191+
```
165192

166-
* Windows:
193+
* Windows:
167194

168-
```powershell
169-
Restart-Service iotedge
170-
```
195+
```powershell
196+
Restart-Service iotedge
197+
```
171198

172199
## Configure deployment manifests
173200

174-
Once your IoT Edge device is configured to work with your proxy server, you need to continue to declare the environment variables in future deployment manifests. Always configure the two runtime modules, edgeAgent and edgeHub, to communicate through the proxy server so they can maintain a connection with IoT Hub. Other IoT Edge modules that connect to the internet should be configured for the proxy server. However, modules that route their messages through edgeHub or that only communicate with other modules on the device don't need the proxy server details.
201+
Once your IoT Edge device is configured to work with your proxy server, you need to continue to declare the environment variables in future deployment manifests. You can edit deployment manifests either using the Azure portal wizard or by editing a deployment manifest JSON file.
202+
203+
Always configure the two runtime modules, edgeAgent and edgeHub, to communicate through the proxy server so they can maintain a connection with IoT Hub. If you remove the proxy information from the edgeAgent module, the only way to reestablish connection is by editing the config.yaml file on the device, as described in the previous section.
204+
205+
Other IoT Edge modules that connect to the internet should be configured to communicate through the proxy server, too. However, modules that route their messages through edgeHub or that only communicate with other modules on the device don't need the proxy server details.
175206

176-
You can create deployment manifests using the Azure portal or manually by editing a JSON file.
207+
This step is ongoing throughout the life of the IoT Edge device.
177208

178209
### Azure portal
179210

0 commit comments

Comments
 (0)