Reputation: 498
I am developing a custom edge module using 'ModuleClient' class. I have to configure a property in device twin and read corresponding value in my edge module.
I know it can be achieved using Device Client class. For that I need the device connection string but I don't have the device connection string handy (since we have thousands of devices we are not encouraging that approach since it creates deployment overhead).
AmqpTransportSettings amqpSetting = new AmqpTransportSettings(TransportType.Amqp_Tcp_Only);
var mqttSetting = new MqttTransportSettings(TransportType.Mqtt_Tcp_Only);
TransportSettings[] settings = { amqpSetting };
// Open a connection to the Edge run-time - create from env with transport type (https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.devices.client.moduleclient.createfromenvironmentasync?view=azure-dotnet)
ioTHubModuleClient = await ModuleClient.CreateFromEnvironmentAsync(settings);
Upvotes: 1
Views: 869
Reputation: 175
There is no options to inbuilt feature to get the device twin from the Iot edge sdk
But there is an work around refer the below link, but its not the recommended approach https://github.com/Azure/iotedge/issues/631
Upvotes: 1