2

The question is with reference to ""https://learn.microsoft.com/en-us/azure/iot-dps/quick-create-simulated-device-x509-python"

The section 'https://learn.microsoft.com/en-us/azure/iot-dps/quick-create-simulated-device-x509-python#simulate-the-device' talks about modifying certain parameters. I get the following error when running the python code.

$ python provisioning_device_client_sample.py -i 0ne0007F9D9 -s X509 -p http

Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609]
Provisioning Device Client for Python
Starting the Provisioning Client Python sample...
    Scope ID=0ne0007F9D9
    Security Device Type X509
    Protocol HTTP

Provisioning API Version: 1.2.12

Press Enter to interrupt...

Register status callback: 
reg_status = CONNECTED
user_context = None

PUT /0ne0007F9D9/registrations/riot-device-cert/register?api-version=2018-09-01-preview HTTP/1.1
UserAgent: prov_device_client/1.0
Accept: application/json
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Host: global.azure-devices-provisioning.net:443
content-length: 39


len: 39
{ "registrationId":"riot-device-cert" }


HTTP Status: 401

date: Thu, 26 Sep 2019 18:48:49 GMT
content-type: application/json; charset=utf-8
transfer-encoding: chunked
x-ms-request-id: 883b82ee-f696-4e68-9aec-61abc1e4a55b
strict-transport-security: max-age=31536000; includeSubDomains

{"errorCode":401002,"trackingId":"883b82ee-f696-4e68-9aec-61abc1e4a55b","message":"CA certificate not found.","timestampUtc":"2019-09-26T18:48:50.364959Z"}

Error: Time:Thu Sep 26 14:48:50 2019 File:/usr/sdk/src/c/provisioning_client/src/prov_device_ll_client.c Func:prov_transport_process_json_reply Line:323 failure retrieving json auth key value
Error: Time:Thu Sep 26 14:48:50 2019 File:/usr/sdk/src/c/provisioning_client/src/prov_transport_http_client.c Func:prov_transport_http_dowork Line:941 Unable to process registration reply.
Error: Time:Thu Sep 26 14:48:50 2019 File:/usr/sdk/src/c/provisioning_client/src/prov_device_ll_client.c Func:on_transport_registration_data Line:572 Failure retrieving data from the provisioning service

Register device callback: 
   register_result = PARSING
   iothub_uri = None
   user_context = None

Device registration failed!

I could not find a location where I should copy the device certificates. May be my understanding is wrong. Help me correct it.

Thanks, Sreeju

1 Answers1

1

Did you use Visual Studio to build the project like they mentioned in the previous step? If so, VS is supposed to wire that in for you so that you don't have to copy the cert anywhere on your end, just use the cert to set up the device on the AzIotHub side.

To troubleshoot why that isn't happening, can you include or link your built provisioning_device_client_sample.py file? It probably shows or points to where the X509SecurityClient class is being instantiated, which will lead to the X509 object, which has an attribute (self._cert_file) that will show the file path. It'd also help if you can run this in a python IDE so we could pull stuff up on a console.

If that is inconvenient, I could build the SDK/sample and run through the thing myself, but I haven't opened up Visual Studio on my VM in ages and will probably need to go through some licensing fandango. (I mostly use the IOTHub Device & Service SDKs, the newer versions of which don't need to be built, or the REST api for areas where the SDKs break.) It'll be a little bit before I have some spare time for that.

Chris Launey
  • 136
  • 6