Closed EliiseS closed 3 years ago
Hi @EliiseS
The iotedgedev tool only supports shared access key authentication to the device in IoT Hub.
Looks like you have created a Edge device entity with X.509 cert. Can you try to create Edge device with Shared Access Key and see if it works?
Your device connection string.
HostName=soak-iot-hub.azure-devices.net;DeviceId=soak-edge-device;x509=true"
Hi @konichi3,
I know my device connection string is a X509 cert connection string and that's why it doesn't work. The command does work if you just don't set the DEVICE_CONNECTION_STRING
.
The question I have, why is the connection string checked on the build command if it's not needed for this operation in the first place?
While I know DPS is not supported officially yet, it would be nice to be able to use iotedgedev build
with DPS without having to not set the DEVICE_CONNECTION_STRING
We added to our backlog the investigation why iotedgedev build requires the connection string.
Hi @EliiseS, the iotedgedev tool initializes and loads environment variables before every single command in the CLI. While we can try to optimize this, we can add in a more helpful error message for DPS connection strings until we provide support for DPS in this tool. Let us know what you think, thanks!
@cindydeng1998
How would you feel about changing this line to:
if "sharedaccesskeyname" not in self:
# log a warning about how this is not a valid connection string for deploying
return
if self.connection_string:
self.shared_access_key_name = self["sharedaccesskeyname"]
You'd also have to create more tests on making sure deployment has a proper error message when sharedaccesskey is not set.
Hello @EliiseS, we published an update to iotedgedev to resolve this issue. Please let us know if you have any questions or feedback, thanks!
@cindydeng1998 Looks great!
Issue fixed in PR https://github.com/Azure/iotedgedev/pull/508
Closing this issue 😄
iotedgedev build
fails with DPS device connection string. Why doesiotedgedev
check the device connection string if it is not required for this operation?Steps to Reproduce:
.env
fileDEVICE_CONNECTION_STRING
to DPS device connection string ("HostName=soak-iot-hub.azure-devices.net;DeviceId=soak-edge-device;x509=true"
) in the.env
iotedgedev build -f <your_deployment_file>
Expected outcome:
deployment is generated in
/config
Actual outcome
Workaround
Remove
DEVICE_CONNECTION_STRING
from the.env
file