I have registered the devices in IoT and the client application (device) can update reported twin properties. Now, I have to update desired twin properties from back end applica
Here's a sample on GitHub. And here's a tutorial.
Here is the relevant piece of code:
public async Task UpdateDesiredProperties(string deviceId)
{
var twin = await _registryManager.GetTwinAsync(deviceId);
var patch =
@"{
properties: {
desired: {
customKey: 'customValue'
}
}
}";
await _registryManager.UpdateTwinAsync(twin.DeviceId, patch, twin.ETag);
}