I'm trying to update tags of device twin through C# SDK in Azure. While executing locally GetNextAsTwinAsync() works perfectly, but after function is deployed on Az fucntion app, the function returns null. I tried debugging the query and it returns true,also I couldn't find any alternative function for the same. My code is
string fetchQuery = $"SELECT * FROM devices WHERE deviceId = '{device.Id}'";
var query = _registry.CreateQuery(fetchQuery, 1);
var page = await query.GetNextAsTwinAsync();
var twin = page.FirstOrDefault();
if (twin != null)
{
var patch =
@"{
tags: {
tenantId: " +
tenantId +
@",
__type__: 'iiotedge',
os: 'linux'
}
}";
_telemetryClient.TrackTrace("updating twin" + $"{patch}");
var UpdateTwinStatus = await _registry.UpdateTwinAsync(twin.DeviceId, patch, twin.ETag)
I want to update device twin tags for a device based on deviceId