You have created an individual enrollment in the Device Provisioning Service and you write the following code to register the device:
provisioning_device_client = ProvisioningDeviceClient.create_from_symmetric_key( Provisioning_host = “my-dps-001.azure-devices-provisioning.net”, Device_id = “device-004”, Id_scope = “0ne00000A0A”, Symmetric_key = “zRuEuGKag+kQKV+T1QGakR...stfha6dhIPWvdD1nRxK5T0KGKA+nQ”, )Which of the parameters is wrong and should be replaced with another one to make the code valid?
Click on the arrows to vote for the correct answer
A. B. C. D.Correct Answer: D.
Option A is incorrect because the host running the Device Provisioning Service is required.
Option B is incorrect because the ID scope uniquely identifies the provisioning service the device will register.
It is required.
Option C is incorrect because it is the symmetric key that will be used to create the shared access signature token to authenticate the device with the DPS.
It is required.
Option D is CORRECT because the device_id is not a parameter for the device provisioning method.
It is the registration_id which has to be used to uniquely identify the device in the DPS.
Reference:
Based on the code provided, the only parameter that appears to be incorrect is "Provisioning_host", which should be "provisioning_host" instead. The parameter names in the code should match the Python function argument names, which are case-sensitive.
Here's the corrected code with the parameter name fixed:
pythonprovisioning_device_client = ProvisioningDeviceClient.create_from_symmetric_key( provisioning_host="my-dps-001.azure-devices-provisioning.net", device_id="device-004", id_scope="0ne00000A0A", symmetric_key="zRuEuGKag+kQKV+T1QGakR...stfha6dhIPWvdD1nRxK5T0KGKA+nQ", )
With this change, the code should be able to register the device using the specified symmetric key with the given provisioning host, device ID, and ID scope.