I have some issue registering the device with the dps over mqtt as well as REST, failed to register the device. Any help here?
Followed the procedure to load the root certificate and verified as well. Doing Group enrolment.
Thanks,
Pradeep
MQTT
mosquitto_pub -d --cafile /home/ubuntu/RND/edge/azure-connect/certs/BaltimoreCyberTrustRoot.crt.pem --cert /home/ubuntu/RND/edge/azure-connect/local/myiotdevice.crt --key /home/ubuntu/RND/edge/azure-connect/local/myiotdevice.key -d -h MyDemoDPS.azure-devices-provisioning.net -p 8883 -t $dps/registrations/PUT/iotdps-register/?$rid=1 -m "{\"registrationId\":\"myiotdevice\"}
Getting below error
Client mosq-Gd5s19yNghmGPQeBja sending CONNECT
Client mosq-Gd5s19yNghmGPQeBja received CONNACK (5)
Connection error: Connection Refused: not authorised.
Client mosq-Gd5s19yNghmGPQeBja sending DISCONNECT
Tried the same with the REST APIs, with curl
curl -v -L -i -X PUT -cert /home/ubuntu/RND/edge/azure-connect/local/myiotdevice.crt -key ./myiotdevice.key -H 'Content-Type:application/json' -H 'Content-Encoding:utf-8' -d '{"registrationId":"myiotdevice"}' https://global.azure-devices-provisioning.net/0ne00211966/registrations/myiotdevice/register?api-version=2019-03-31 --tlsv1.2
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
* Could not resolve host: .
* Closing connection 0
curl: (6) Could not resolve host: .
* Trying 52.163.212.39:443...
* TCP_NODELAY set
* Connected to global.azure-devices-provisioning.net (52.163.212.39) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=*.azure-devices-provisioning.net
* start date: Oct 30 17:29:27 2020 GMT
* expire date: Oct 30 17:29:27 2021 GMT
* issuer: C=US; O=Microsoft Corporation; CN=Microsoft RSA TLS CA 01
* SSL certificate verify ok.
> PUT /0ne00211966/registrations/myiotdevice/register?api-version=2019-03-31 HTTP/1.1
> Host: global.azure-devices-provisioning.net
> User-Agent: curl/7.68.0
> Accept: */*
> Referer: y
> Content-Type:application/json
> Content-Encoding:utf-8
> Content-Length: 32
>
* upload completely sent off: 32 out of 32 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< Date: Sat, 30 Jan 2021 13:22:20 GMT
Date: Sat, 30 Jan 2021 13:22:20 GMT
< Content-Type: application/json; charset=utf-8
Content-Type: application/json; charset=utf-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< x-ms-request-id: b90fa549-791f-4d41-aaa9-ba315739b546
x-ms-request-id: b90fa549-791f-4d41-aaa9-ba315739b546
< Strict-Transport-Security: max-age=31536000; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubDomains
<
* Connection #1 to host global.azure-devices-provisioning.net left intact
{"errorCode":401002,"trackingId":"b90fa549-791f-4d41-aaa9-ba315739b546","message":"Unauthorized","timestampUtc":"2021-01-30T13:22:21.691564Z"}