Closed cbellee closed 1 year ago
Hi @cbellee, my coworker followed up on this issue by replied your email, we are wondering can you try set up the content type and content encoding using this flag below and see now if the routing applies correctly? (the help text show up when you do az iot device send-d2c-message
)
--properties --props -p : Message property bag in key-value pairs with the following
format: a=b;c=d. For mqtt messaging - you are able to send system
properties using $.<name>=value
. For instance $.cid=12345
sets
the system correlation Id property. Other system property
identifier examples include $.ct
for content type, $.mid
for
message Id and $.ce
for content encoding.
For your case you can do for example:
az iot device send-d2c-message -n <hubname> -p "$.ct=application/json;$.ce=utf-8" -d <deviceid> --data <json content>
Also I have some questions:
Thanks a lot!
On top of the prior relayed information, we have a recent release v0.20.2
that improves binary support with the addition of a --data-file-path
parameter.
For example:
az iot device send-d2c-message -n {iothub_name} -d {device_id} --props '$.ct=application/octet-stream' --data-file-path {file_path}
Let us know if you have any further feedback or questions.
az iot device send-d2c-message -n {iothub_name} -d {device_id} --data
doesn't allow for different data formats to be used, only utf-8.Description
--data
flag needs an option to define data formats, e.g. utf-8, binary, application/json, etc.Steps to reproduce the behavior: $
az iot device send-d2c-message -n {iothub_name} -d {device_id} --data
Expected behavior An additional parameter for the command would allow the user to specify a data format type, such as
--data-type {utf8 | binary | json}
Environment
azure-cli 2.46.0 core 2.46.0 telemetry 1.0.8
Extensions: aks-preview 0.5.132 azure-devops 0.26.0 azure-firewall 0.14.5 azure-iot 0.21.0 containerapp private-preview-1.0.5 front-door 1.0.17 k8s-configuration 1.7.0 k8s-extension 1.4.0 load 0.2.0 ml 2.14.1 ssh 1.1.5 storage-preview 0.8.3 virtual-wan 0.2.16 webpubsub 1.2.0
Dependencies: msal 1.20.0 azure-mgmt-resource 21.1.0b1
Python location '/opt/az/bin/python3' Extensions directory '/home/cbellee/.azure/cliextensions'
Python (Linux) 3.10.10 (main, Mar 6 2023, 09:39:55) [GCC 9.4.0]