1

我在 Azure 上运行了标准 D2s v3(2 vcpus,8 GB 内存),并安装了 Python、Docker 和 iotedgectl。

当我跑

iotedgectl setup --connection-string "HostName=***.azure-devices.net;DeviceId=***;SharedAccessKey=***" --auto-cert-gen-force-no-passwords

我收到以下错误

ERROR: Error parsing user input data: Invalid hostname. Hostname cannot be empty or greater than 64 characters: ****.nwq4jyrgm4zejiseat2enywp0h.fx.internal.cloudapp.net.
ERROR: Please fix any input values and re-run 'iotedgectl setup'
ERROR: Errors were observed. Return Code: 1

有任何想法吗?

4

1 回答 1

2

The IoT Edge runtime requires a hostname to generate a TLS server certificate for the Edge Hub. This enables verifiable TLS connections between modules and leaf devices (for gateway scenarios). Per RFC3280, the maximum length of the Common Name for an SSL certificate is 64 chars. (search for ub-common-name-length).

This error is indicating that the hostname exceeds this limit. By default, the iotedgectl tool detects and uses the hostname of the host machine. Unfortunately, Azure Windows VMs have very long hostnames.

To remedy this, you can set the hostname and bypass the auto detection like so:

iotedgectl setup --connection-string "<conn string>" --auto-cert-gen-force-no-passwords --edge-hostname <a shorter hostname>

If you are interested in using IoT Edge as a gateway, there is more information here: https://docs.microsoft.com/en-us/azure/iot-edge/how-to-create-transparent-gateway

于 2017-12-14T16:49:12.373 回答