Wang, David Welcome to Microsoft Q&A forum!
Which documentation are you following? How exactly are you connecting a device to DPS?
Did you check Communicate with your DPS using the MQTT protocol?
/api-version=2019-03-31&ClientVersion=1.3.7 | CLEAN: 130 | USERNAME: 0ne001A13DC/registrations/80220928000279 <- 09:36:04 CONNACK | SESSION_PRESENT: false | RETURN_CODE: 0x5
The error code 5 in the MQTT CONNACK response indicates that the client is not authorized to connect. This error can occur if the SAS token used in the MQTT CONNECT request is invalid or has expired.
To resolve this issue, you should check the format of the SAS token and make sure it is correct. The format of the SAS token should be the same as for both the HTTPS and AMQP protocols: SharedAccessSignature sr={URL-encoded-resourceURI}&sig={signature-string}&se={expiry}&skn=registration The resourceURI should be in the format {idScope}/registrations/{registration_id}. The policy name (skn) should be set to registration.
If you need further help in this matter, please comment in the below section and we are happy to discuss!
If this answers your query, do click Accept Answer and Yes for this answer as helpful. And, if you have any further query do let us know by commenting in the below section.