iotedgedev
iotedgedev copied to clipboard
Add support for DPS
In our project we're using DPS to provison our edge devices. Right now we have a mixed solution of using iotedgedev build --push
and az iot edge deployment create
for our deployments. This works when you don't set the DEVICE_CONNECTION_STRING
in the .env
file.
Would it be possible to add DPS support for iotedge deploy
and do you have plans to support it?
Example of a DPS provisioned device connection string:
HostName=soak-iot-hub.azure-devices.net;DeviceId=soak-edge-device;x509=true
Example of a regular device connection string:
HostName=iotedgedev-iothub-d278b7.azure-devices.net;DeviceId=iotedgedev-edgedevice;SharedAccessKey=NfS9UhVSljRM4=
Steps to reproduce issue:
- Provision and set up IoTEdge with a Virtual Machine by following the QuickStart guide
- In the generated
.env
replaceDEVICE_CONNECTION_STRING
value with"HostName=soak-iot-hub.azure-devices.net;DeviceId=<your_edge_device_id>;x509=true"
where the<your_edge_device_id>
is the same as theDeviceId
from your originalDEVICE_CONNECTION_STRING
- Retry:
iotedgedev solution deploy
Current solution
The DEVICE_CONNECTION_STRING
value is only required for extracting the DeviceId
for all commands in the iotedgedev
CLI, with the exception of the commands that use the simulator (iotedgehubdev
).
The .env
template also already contains EDGE_DEVICE_ID
value, which id currently only used to retrieve the device connection string using Azure CLI
:
There are a number of commands that check that the DEVICE_CONNECTION_STRING
is set in commands that only use the DeviceId
:
When using a DPS device connection string, the device connection string is set to empty, failing the above validations:
Implementation suggestion
- Set the
DeviceId
from eitherDEVICE_CONNECTION_STRING
orEDGE_DEVICE_ID
, favoring one over the other when both are set or failing validation if both are set to a differentDeviceIds
- Change validation for commands that only require
DeviceId
to only verifyDeviceId
is set- Change
iotedgedev solution deploy
validation #576
- Change
- When the
DEVICE_CONNECTION_STRING
is a DPS connection string, still extract and set theDeviceId
#576
hi! :)
I'll pick this up