[Technical Question] How can we instantiate DeviceClient in the context of an Edge Module?
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 473
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 7
Description
We would like to make use of the file upload feature provided by the IoT Hub. Namely automatic management of storage SAS tokens and upload notifications.
Unfortunately you need a `DeviceClient` instance and that seems to be very hard to correctly instantiate in a edge module context. In particular pretty much all examples you find out there omit the hard part that is "put your connection string here".
Options we have looked into
1. There is a local blob storage module where you can store blobs locally and sync to a storage account. Problems:
1. You need to configure the blob storage credentials on the module - i.e. account and shared access key. This is something that we want to avoid (think rotating storage account keys)
2. It automatically writes all data to local disk which is hurting the flash lifetime. Bandwidth is more longer-term reliable than local flash write-lifetime in our scenario
1. Instantiate `DeviceClient` via connection string - well, hard-coding is not an option and passing it via a module twin prop is just slightly less bad.
1. Make our own module that gets configured with the storage account creds. This solves the data persistence requirement (since we can just upload from a memory stream) but not the credentials problem of the first point above.
1. Send a specially crafted message that triggers a function to pass down a SAS token. This is re-inventing the wheel and seems a waste when the IoT Hub already has everything built-in.
1. Map and parse the iotedge config like done in https://github.com/Azure/iotedge/issues/205 but this will most likely fall apart when using DPS.
So being able to instantiate a `DeviceClient` from the environment without having to hard-code/configure any account secrets seems like a way to make it work but it's not obvious how.
It's really very unfortunate that iotedge devices have seemingly been left hang out to dry while all the require infra to make this work nicely is all there.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.