az iot device c2d-message

Cloud-to-device messaging commands.

Commands

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

az iot device c2d-message abandon

Abandon a cloud-to-device message.

az iot device c2d-message abandon --device-id
--etag
[--hub-name]
[--login]
[--resource-group]

Required Parameters

--device-id -d

Target Device.

--etag -e

Entity tag value.

Optional Parameters

--hub-name -n

IoT Hub name.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

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

az iot device c2d-message complete

Complete a cloud-to-device message.

az iot device c2d-message complete --device-id
--etag
[--hub-name]
[--login]
[--resource-group]

Required Parameters

--device-id -d

Target Device.

--etag -e

Entity tag value.

Optional Parameters

--hub-name -n

IoT Hub name.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

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

az iot device c2d-message receive

Receive a cloud-to-device message.

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

Required Parameters

--device-id -d

Target Device.

Optional Parameters

--hub-name -n

IoT Hub name.

--lock-timeout --lt

Specifies the amount of time a message will be invisible to other receive calls.

default value: 60
--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

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

az iot device c2d-message reject

Reject or deadletter a cloud-to-device message.

az iot device c2d-message reject --device-id
--etag
[--hub-name]
[--login]
[--resource-group]

Required Parameters

--device-id -d

Target Device.

--etag -e

Entity tag value.

Optional Parameters

--hub-name -n

IoT Hub name.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

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

az iot device c2d-message send

Send a cloud-to-device message.

az iot device c2d-message send --device-id
[--ack {full, negative, positive}]
[--cid]
[--da]
[--hub-name]
[--login]
[--properties]
[--repair {false, true}]
[--resource-group]
[--wait {false, true}]
[--yes {false, true}]

Examples

Basic usage with default message body

az iot device c2d-message send -d {device_id} -n {iothub_name}

Send cloud-to-device message with custom data and properties.

az iot device c2d-message send -d {device_id} -n {iothub_name} --data 'Hello World' --props 'key0=value0;key1=value1'

Send a C2D message and wait for device acknowledgement

az iot device c2d-message send -d {device_id} -n {iothub_name} --wait

Required Parameters

--device-id -d

Target Device.

Optional Parameters

--ack

Request the delivery of per-message feedback regarding the final state of that message. The description of ack values is as follows. Positive: If the c2d message reaches the Completed state, IoT Hub generates a feedback message. Negative: If the c2d message reaches the Dead lettered state, IoT Hub generates a feedback message. Full: IoT Hub generates a feedback message in either case. By default, no ack is requested.

accepted values: full, negative, positive
--cid --correlation-id

Correlation Id associated with message.

--da --data

Message body.

default value: Ping from Az CLI IoT Extension
--hub-name -n

IoT Hub name.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--properties --props -p

Message property bag in key-value pairs with the following format: a=b;c=d.

--repair -r

Reinstall uamqp dependency compatible with extension version. Default: false.

accepted values: false, true
--resource-group -g

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

--wait -w

If set the c2d send operation will block until device feedback has been received.

accepted values: false, true
--yes -y

Skip user prompts. Indicates acceptance of dependency installation (if required). Used primarily for automation scenarios. Default: false.

accepted values: false, true