IoT device messaging - az iot device message

Manage IoT device messaging.

These commands are in preview.

Commands

az iot device message abandon Abandon a cloud-to-device message.
az iot device message complete Complete a cloud-to-device message.
az iot device message receive Receive a cloud-to-device message.
az iot device message reject Reject a cloud-to-device message.
az iot device message send Send a device-to-cloud message.

az iot device message abandon

Abandon a cloud-to-device message.

az iot device message abandon --device-id
--hub-name
--lock-token
[--resource-group]

Required Parameters

--device-id -d

Device Id.

--hub-name

IoT Hub name.

--lock-token

Message lock token.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az iot device message complete

Complete a cloud-to-device message.

az iot device message complete --device-id
--hub-name
--lock-token
[--resource-group]

Required Parameters

--device-id -d

Device Id.

--hub-name

IoT Hub name.

--lock-token

Message lock token.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az iot device message receive

Receive a cloud-to-device message.

az iot device message receive --device-id
--hub-name
[--lock-timeout]
[--resource-group]

Examples

Receive a cloud-to-device message from an IoT Hub with a default lock timeout.

az iot device message receive --hub-name MyIotHub --device-id MyDevice

Receive a cloud-to-device message from an IoT Hub with a lock timeout of 300 seconds.

az iot device message receive --hub-name MyIotHub --device-id MyDevice --lock-timeout 300

Required Parameters

--device-id -d

Device Id.

--hub-name

IoT Hub name.

Optional Parameters

--lock-timeout

In case a message returned to this call, this specifies the amount of time in seconds, the message will be invisible to other receive calls.

default value: 60
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az iot device message reject

Reject a cloud-to-device message.

az iot device message reject --device-id
--hub-name
--lock-token
[--resource-group]

Required Parameters

--device-id -d

Device Id.

--hub-name

IoT Hub name.

--lock-token

Message lock token.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az iot device message send

Send a device-to-cloud message.

az iot device message send --device-id
--hub-name
[--correlation-id]
[--data]
[--message-id]
[--resource-group]
[--user-id]

Examples

Send a device-to-cloud message to an IoT Hub with a default message.

az iot device message send --hub-name MyIotHub --device-id MyDevice

Send a device-to-cloud message to an IoT Hub with a custom message.

az iot device message send --hub-name MyIotHub --device-id MyDevice --data "Custom Message"

Required Parameters

--device-id -d

Device Id.

--hub-name

IoT Hub name.

Optional Parameters

--correlation-id

Device-to-cloud message correlation Id.

--data

Device-to-cloud message body.

default value: Ping from Azure CLI
--message-id

Device-to-cloud message Id.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

--user-id

Device-to-cloud message user Id.