0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Azure IoT Hub に az-cli で pub/sub

Last updated at Posted at 2021-01-16

sas トークンで接続する場合です。

publish.sh
HubName=iot-aa
deviceId=pansy
#
ddx=`date`
az iot device c2d-message send  -d ${deviceId} \
        --data "Hello World $ddx" \
        --props "key0=value0;key1=value1" -n ${HubName}
#

こちらのプログラムで subscribe した結果
Azure IoT Hub に paho で pub/sub

***on_message ***
devices/pansy/messages/devicebound/%24.mid=31e11faf-385d-4ff2-a10d-ff4ed0d90205&%24.to=%2Fdevices%2Fiwata%2Fmessages%2Fdevicebound&%24.ce=utf-8&key0=value0&key1=value1&iothub-ack=none Hello World 2021年  1月 16日 土曜日 15:50:02 JST

次のようなメッセージが出たら、az login を行って下さい。

AADSTS50132: The session is not valid due the following reasons: password expiration or recent password change, SSO Artifact is invalid or expired, session is not fresh enough for application, or a silent sign-in request was sent but the user's session with Azure AD is invalid or has expired.
$ az login
You have logged in. Now let us find all the subscriptions to which you have access...
subscribe.sh
#
HubName=iot-aa
deviceId=pansy
#
az iot device simulate -d ${deviceId} -n ${HubName}
#
az iot hub monitor-events --output table --hub-name ${HubName}
#
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?