Ananda
Ananda

Reputation: 1572

Azure IoT: How to access device twin metadata in stream job and azure function?

Is it possible to access device twin meta data in stream jobs. I know I can upload data to blob store and access that in my stream job but that becomes very cumbersome.

Is there a way I can access device metadata (tags, desired properties, reported properties) in stream job so I can persist and make decision accordingly?

Upvotes: 1

Views: 835

Answers (1)

Roman Kiss
Roman Kiss

Reputation: 8235

Basically, there are two ways how to persist the device twins.

The first one is to call a bulk job for exporting all devices to the Azure Blob Storage in the json formatted text. See more details here. You can use a BlobTrigger Function to evaluate a blob contents or referencing a blob to the stream job.

The second way to persist a device twin is persisting a changes on the device twin. The Azure IoT Hub Routes can be configured with a route for TwinChangeEvents to the custom endpoint such as Azure Blob Storage. Note, that the blob data has an avro serialized format. More details about this routes is here.

Based on the above, both blobs can be referenced to the stream job for their analyzing.

Upvotes: 1

Related Questions