Skip to main content
Version: 2.3

Azure IoT Hub Trigger Nodes

Azure IoT Hub provides two trigger node types that automatically start pipeline executions when events arrive from the cloud: C2D Trigger for cloud-to-device messages and Twin Desired Trigger for Device Twin desired property changes.

TriggerEvent SourceCommon Use Cases
C2D TriggerCloud-to-device messagesRemote commands, firmware updates, device reboots
Twin Desired TriggerDevice Twin desired property changesConfiguration pushes, set-point adjustments, feature flag updates

Both triggers share the same configuration structure, reconnection handling, and execution settings.


Core Functionality

What They Do

1. Event-Driven Pipeline Execution Start pipelines automatically when Azure IoT Hub events arrive, without manual intervention or polling. The C2D Trigger responds to cloud-to-device messages, while the Twin Desired Trigger responds to desired property changes.

2. Automatic Subscription Management Subscriptions are created and cleaned up automatically — no manual MQTT subscription management required. The system handles connection lifecycle and resubscription after reconnections.

3. Change Detection (Optional) Both triggers support an onChange mode that suppresses duplicate events. When enabled, the trigger only fires when the incoming payload differs from the last received payload, reducing unnecessary pipeline executions.


Reconnection Handling

MaestroHub automatically handles connection disruptions to ensure reliable event delivery.

Automatic Recovery

When an Azure IoT Hub connection is lost and restored:

  1. Connection Lost: The system detects the disconnection automatically
  2. Connection Restored: Subscriptions are automatically re-established within seconds
  3. SAS Token Renewal: For SAS-based authentication, tokens are renewed automatically at 75% of their TTL
  4. Transparent Recovery: Pipelines continue to receive events once the connection is restored — no manual intervention required

What This Means for Your Workflows

ScenarioBehavior
Brief network interruptionAutomatic resubscription after reconnection
SAS token expiryToken is renewed automatically before expiry via disconnect/reconnect
MaestroHub restartAll triggers for enabled pipelines are restored on startup

Azure IoT Hub C2D Trigger Node interface

Azure IoT Hub C2D Trigger node

Azure IoT Hub C2D Trigger Node

The C2D Trigger Node automatically initiates pipelines when cloud-to-device messages arrive from Azure IoT Hub. Use this to execute remote commands, handle firmware update notifications, or process any message sent from the cloud to a specific device.

Configuration

Basic Information

FieldTypeDescription
Node LabelString (Required)Display name for the node on the pipeline canvas
DescriptionString (Optional)Explains what this trigger initiates

Parameters

ParameterTypeDefaultRequiredConstraintsDescription
ConnectionConnection ID""Yes--Azure IoT Hub connection profile to use.
FunctionFunction ID""Yes--C2D Receive function within the connection.
Trigger ModeSelect"always"Noalways / onChangealways: Trigger on every C2D message. onChange: Only trigger when payload differs from the last received message.
EnabledBooleantrueNo--Enable or disable the trigger.
Dedup Max KeysNumber1000If onChange1--10,000Maximum tracked message hashes for change detection.
Function Requirement

The selected function must be a C2D Receive function type (iothub.c2d.receive). D2C Send, Twin Report, and Twin Desired functions cannot be used with C2D Trigger nodes.

Output Data Structure

When a C2D message triggers pipeline execution, the following data is available to downstream nodes.

Output Format

{
"payload": {
"command": "reboot",
"delay": 30
},
"_metadata": {
"nodeId": "trigger.azureiothub.c2d-1",
"nodeType": "trigger.azureiothub.c2d",
"type": "azureiothub_c2d_trigger",
"connection_id": "bf29be94-fc0a-4dc4-8e5c-092f1b74eb4b",
"function_id": "aef374c3-aa2b-454e-aabc-5657faac5950",
"topic": "devices/my-device/messages/devicebound/",
"content_type": "application/json",
"properties": {
"commandType": "maintenance"
},
"timestamp": "2026-04-03T10:30:45Z"
}
}

_metadata Fields

FieldTypeDescription
nodeIdstringThe trigger node identifier on the canvas
nodeTypestringAlways "trigger.azureiothub.c2d"
typestringAlways "azureiothub_c2d_trigger"
connection_idstringThe Azure IoT Hub connection profile ID
function_idstringThe C2D Receive function ID
topicstringMQTT topic the message was received on
content_typestringMIME type of the message body
propertiesobjectMessage application properties extracted from the MQTT topic property bag
timestampstringISO 8601 timestamp of when the message was received

payload Fields

The payload contains the parsed C2D message body. The format depends on the Output Format configured on the C2D Receive function:

Output FormatPayload TypeDescription
jsonobjectParsed JSON object
textstringRaw message body as a string
base64stringBinary message body encoded as base64

Referencing in Downstream Nodes

Use expressions to access C2D trigger data in subsequent nodes:

  • $trigger.payload — the full C2D message content
  • $trigger.payload.command — access a specific field in the message
  • $trigger._metadata.connection_id — connection profile used
  • $trigger._metadata.properties.commandType — access a routing property
  • $trigger._metadata.timestamp — when the message was received

Azure IoT Hub Twin Desired Trigger Node interface

Azure IoT Hub Twin Desired Trigger node

Azure IoT Hub Twin Desired Trigger Node

The Twin Desired Trigger Node automatically initiates pipelines when Device Twin desired property changes arrive from Azure IoT Hub. Use this to react to configuration pushes, set-point adjustments, or feature flag updates sent from the cloud.

Configuration

Basic Information

FieldTypeDescription
Node LabelString (Required)Display name for the node on the pipeline canvas
DescriptionString (Optional)Explains what this trigger initiates

Parameters

ParameterTypeDefaultRequiredConstraintsDescription
ConnectionConnection ID""Yes--Azure IoT Hub connection profile to use.
FunctionFunction ID""Yes--Twin Desired function within the connection.
Trigger ModeSelect"always"Noalways / onChangealways: Trigger on every desired property change. onChange: Only trigger when the version number differs from the last event.
EnabledBooleantrueNo--Enable or disable the trigger.
Dedup Max KeysNumber1000If onChange1--10,000Maximum tracked version hashes for change detection.
Function Requirement

The selected function must be a Twin Desired function type (iothub.twin.desired). Other function types cannot be used with Twin Desired Trigger nodes.

Output Data Structure

When a desired property change triggers pipeline execution, the following data is available to downstream nodes.

Output Format

{
"payload": {
"targetTemperature": 72.5,
"reportInterval": 30,
"$version": 5
},
"_metadata": {
"nodeId": "trigger.azureiothub.twin-1",
"nodeType": "trigger.azureiothub.twin",
"type": "azureiothub_twin_trigger",
"connection_id": "bf29be94-fc0a-4dc4-8e5c-092f1b74eb4b",
"function_id": "aef374c3-aa2b-454e-aabc-5657faac5950",
"version": "5",
"source": "desired",
"is_full_twin": false,
"timestamp": "2026-04-03T10:30:45Z"
}
}

_metadata Fields

FieldTypeDescription
nodeIdstringThe trigger node identifier on the canvas
nodeTypestringAlways "trigger.azureiothub.twin"
typestringAlways "azureiothub_twin_trigger"
connection_idstringThe Azure IoT Hub connection profile ID
function_idstringThe Twin Desired function ID
versionstringVersion number of the twin desired property update
sourcestringSource indicator for the desired property change
is_full_twinbooleantrue if this is a full twin document (initial fetch on subscribe), false for incremental updates
timestampstringISO 8601 timestamp of when the event was received

payload Fields

The payload contains the desired property change data as a JSON object. This includes:

  • All changed desired properties as key-value pairs
  • $version — the twin version number assigned by Azure IoT Hub

When is_full_twin is true (initial fetch on subscribe), the payload contains the complete desired properties section of the Device Twin.

Property Filtering

If the Twin Desired function has a Property Filter configured, only changes to the specified properties will trigger the pipeline. For example, if the filter is set to ["targetTemperature"], changes to other desired properties will be ignored.

Referencing in Downstream Nodes

Use expressions to access twin trigger data in subsequent nodes:

  • $trigger.payload — the full desired property change
  • $trigger.payload.targetTemperature — access a specific desired property
  • $trigger.payload.$version — the twin version number
  • $trigger._metadata.version — version number (also in metadata)
  • $trigger._metadata.is_full_twin — whether this is a full twin or incremental update
  • $trigger._metadata.connection_id — connection profile used

Settings Tab (Both Triggers)

Both trigger node types share the same Settings tab:

Description

A free-text area for documenting the node's purpose and behavior. Notes entered here are saved with the pipeline and visible to all team members.

Execution Settings

SettingOptionsDefaultDescription
Timeout (seconds)NumberPipeline defaultMaximum execution time for this node (1--600). Leave empty for pipeline default.
Retry on TimeoutPipeline Default / Enabled / DisabledPipeline DefaultWhether to retry the node if it times out.
Retry on FailPipeline Default / Enabled / DisabledPipeline DefaultWhether to retry on failure. When Enabled, shows Advanced Retry Configuration.
On ErrorPipeline Default / Stop Pipeline / Continue ExecutionPipeline DefaultBehavior when node fails after all retries.

Advanced Retry Configuration (visible when Retry on Fail = Enabled)

FieldTypeDefaultRangeDescription
Max AttemptsNumber31--10Maximum retry attempts.
Initial Delay (ms)Number1000100--30,000Wait before first retry.
Max Delay (ms)Number1200001,000--300,000Upper bound for backoff delay.
MultiplierNumber2.01.0--5.0Exponential backoff multiplier.
Jitter FactorNumber0.10--0.5Random jitter (+-percentage).

Validation Rules

Parameter Validation (Both Triggers)

Connection ID

  • Must be provided and non-empty
  • Must reference a valid Azure IoT Hub connection profile
  • Error: "connectionId is required"

Function ID

  • Must be provided and non-empty
  • Must reference a valid function of the correct type (C2D Receive or Twin Desired)
  • Function must belong to the specified connection
  • Error: "functionId is required"

Enabled Flag

  • Must be a boolean if provided
  • Error: "enabled must be a boolean"

Usage Examples

Remote Command Execution (C2D Trigger)

Scenario: Execute maintenance commands sent from Azure IoT Hub to edge devices.

Configuration:

  • Label: Maintenance Command Handler
  • Connection: Factory Edge Gateway
  • Function: C2D Receive function (output format: JSON)
  • Trigger Mode: always
  • Enabled: true

Downstream Processing:

  • Parse command type from $trigger.payload.command
  • Route via Condition node based on command type
  • Execute the action (PLC write, service restart, etc.)
  • Report completion via Twin Report node

Dynamic Configuration Updates (Twin Desired Trigger)

Scenario: Adjust device operating parameters when cloud-side desired properties change.

Configuration:

  • Label: Device Configuration Sync
  • Connection: Production IoT Hub
  • Function: Twin Desired function with property filter ["targetTemperature", "reportInterval"]
  • Trigger Mode: always
  • Enabled: true

Downstream Processing:

  • Read new values from $trigger.payload.targetTemperature and $trigger.payload.reportInterval
  • Apply configuration to local device via PLC write
  • Confirm applied values by reporting twin properties via Twin Report node

Firmware Update Notification (C2D Trigger)

Scenario: Start a firmware update workflow when a C2D command arrives.

Configuration:

  • Label: Firmware Update Trigger
  • Connection: Device Management Hub
  • Function: C2D Receive function (output format: JSON)
  • Trigger Mode: onChange (prevent duplicate update triggers)
  • Enabled: true

Downstream Processing:

  • Extract firmware URL from $trigger.payload.firmwareUrl
  • Download firmware via REST HTTP node
  • Apply update and report progress via Twin Report node

Best Practices

Designing for Reliability

PracticeRationale
Use QoS 1 for the connectionEnsures at-least-once delivery of C2D and twin notifications
Enable Store & Forward on the connectionBuffers D2C telemetry during outages for reliable acknowledgment flows
Keep Fetch Twin on Connect enabledEnsures the device starts with a current view of desired properties
Use Property Filter on Twin Desired functionsReduces noise from irrelevant property changes

Error Handling Strategies

For Critical Workflows (e.g., safety commands):

  • Set On Error to Stop Pipeline
  • Monitor pipeline execution failures
  • Implement alerting for stopped pipelines

For Best-Effort Processing (e.g., telemetry configuration):

  • Set On Error to Continue Execution
  • Log failed executions for later analysis
  • Ensure downstream nodes handle partial failures gracefully

onChange Mode

  • Use onChange for idempotent operations where reprocessing the same payload is wasteful
  • Use always (default) when every event must be processed regardless of content
  • The Dedup Max Keys setting controls memory usage for change detection — increase for high-cardinality scenarios