Reference:
https://docs.microsoft.com/en-us/azure/iot-dps/quick-setup-auto-provision
https://docs.microsoft.com/en-us/azure/iot-dps/iot-dps-mqtt-support
Instructions
In order to use DPS via MQTT, the user, pw, subtopic, and pubtopic need to be used. The sub/pub is used as a pipeline to communicate with the server.
Set user:
+set,user:{idScope}/registrations/{registration_id}/api-version=2019-03-31
Where {idScope} is the DPS idScope such as: 0ne001524A7
sig-test-device-3
+set,user:0ne001524A7/registrations/sig-test-device-3/api-version=2019-03-31
Set password for shared access token
+set,pw:SharedAccessSignature sr={URL-encoded-resourceURI}&sig={signature-string}&se={expiry}&skn=registration
where resourceURI should be in the format {idScope}/registrations/{registration_id}
. The policy name should be registration
OR for x.509 certificates load the keys onto the device and clear the pw
variable
+set,pw:
Setup topics
+set,subtopic:$dps/registrations/res/#
+set,pubtopic:$dps/registrations/PUT/iotdps-register/?$rid={request_id}
Push Device Registration message.
Wait for message:
$dps/registrations/res/202/?$rid={request_id}&retry-after=x
Then poll (retry by the time is suggests) by waiting then pushing
+set,pubtopic:$dps/registrations/GET/iotdps-get-operationstatus/?$rid={request_id}&operationId={operationId}
+push,queue1,?
Wait for message:
$dps/registrations/res/200/?$rid={request_id}
Comments
0 comments
Please sign in to leave a comment.