az iot device c2d-message
Note
This reference is part of the azure-iot extension for the Azure CLI (version 2.24.1 or higher). The extension will automatically install the first time you run an az iot device c2d-message command. Learn more about extensions.
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 purge |
Purge cloud-to-device message queue for a target device. |
| 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
Target Device.
Etag or entity tag corresponding to the last state of the resource. If no etag is provided the value '*' is used.
Optional Parameters
IoT Hub name. Required if --login is not provided.
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. Required if --hub-name is not provided.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
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
Target Device.
Etag or entity tag corresponding to the last state of the resource. If no etag is provided the value '*' is used.
Optional Parameters
IoT Hub name. Required if --login is not provided.
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. Required if --hub-name is not provided.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az iot device c2d-message purge
Purge cloud-to-device message queue for a target device.
az iot device c2d-message purge --device-id
[--hub-name]
[--login]
[--resource-group]
Required Parameters
Target Device.
Optional Parameters
IoT Hub name. Required if --login is not provided.
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. Required if --hub-name is not provided.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az iot device c2d-message receive
Receive a cloud-to-device message.
Note: Only one message ack argument [--complete, --reject, --abandon] will be accepted.
az iot device c2d-message receive --device-id
[--abandon {false, true}]
[--complete {false, true}]
[--hub-name]
[--lock-timeout]
[--login]
[--reject {false, true}]
[--resource-group]
Examples
Basic usage
az iot device c2d-message receive -d {device_id} -n {hub_name} -g {resource_group}
Receive a message and set a lock timeout of 30 seconds for that message
az iot device c2d-message receive -d {device_id} -n {hub_name} -g {resource_group} --lt {30}
Receive a message and ack it as 'complete' after it is received
az iot device c2d-message receive -d {device_id} -n {hub_name} -g {resource_group} --complete
Receive a message and reject it after it is received
az iot device c2d-message receive -d {device_id} -n {hub_name} -g {resource_group} --reject
Required Parameters
Target Device.
Optional Parameters
Abandon the cloud-to-device message after receipt.
Complete the cloud-to-device message after receipt.
IoT Hub name. Required if --login is not provided.
Specifies the amount of time a message will be invisible to other receive calls.
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. Required if --hub-name is not provided.
Reject the cloud-to-device message after receipt.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
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
Target Device.
Etag or entity tag corresponding to the last state of the resource. If no etag is provided the value '*' is used.
Optional Parameters
IoT Hub name. Required if --login is not provided.
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. Required if --hub-name is not provided.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az iot device c2d-message send
Send a cloud-to-device message.
EXPERIMENTAL requires Python 3.4+ This command relies on and may install dependent Cython package (uamqp) upon first execution. https://github.com/Azure/azure-uamqp-python.
az iot device c2d-message send --device-id
[--ack {full, negative, positive}]
[--auth-type {key, login}]
[--ce]
[--cid]
[--content-type]
[--da]
[--expiry]
[--hub-name]
[--login]
[--message-id]
[--properties]
[--repair {false, true}]
[--resource-group]
[--uid]
[--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} --ack full --wait
Required Parameters
Target Device.
Optional Parameters
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.
Indicates whether the operation should auto-derive a policy key or use the current Azure AD session. You can configure the default using az configure --defaults iothub-data-auth-type=<auth-type-value>.
The encoding for the C2D message body.
The correlation Id associated with the C2D message.
The content type for the C2D message body.
Message body.
Units are milliseconds since unix epoch. If no time is indicated the default IoT Hub C2D message TTL is used.
IoT Hub name. Required if --login is not provided.
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. Required if --hub-name is not provided.
The C2D message Id. If no message Id is provided a UUID will be generated.
Message property bag in key-value pairs with the following format: a=b;c=d.
Reinstall uamqp dependency compatible with extension version. Default: false.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
The C2D message, user Id property.
If set the c2d send operation will block until device feedback has been received.
Skip user prompts. Indicates acceptance of dependency installation (if required). Used primarily for automation scenarios. Default: false.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
الملاحظات
إرسال الملاحظات وعرضها المتعلقة بـ