The call to register a device to IoTCentral returns an exception, but the device does become visible in the web app (under Unassociated Devices).
Googled, couldn't find anything. Ran with DEBUG=*, saw
azure-iot-provisioning-device-http:Http {"operationId":"4.dd5e9d546d057f12.8a2a1010-281f-4ac1-a29f-591800934ecc","status":"failed","registrationState":{"registrationId":"jeffsdeskjune","createdDateTimeUtc":"2019-06-17T14:25:14.7183582Z","status":"failed","errorCode":400209,"errorMessage":"Custom allocation failed with
status code: 401","lastUpdatedDateTimeUtc":"2019-06-17T14:25:14.8832611Z","etag":"IjZkMDBmY2MwLTAwMDAtMDEwMC0wMDAwLTVkMDdhMmNhMDAwMCI="}}
401 would be Unauthorized, but what is this "Custom allocation"? Is the missing authorization something which is expected to be provided by this virgin device which is trying to register itself, or is it some service-to-service thing?
The code (Javascript/Node):
var transport = new Transport();
var securityClient = new X509Security(registrationId, deviceCert);
deviceClient = ProvisioningDeviceClient.create(provisioningHost, idScope, transport, securityClient);
// Register the device. Do not force a re-registration.
deviceClient.register(function (err, result) {
if (err) {
console.log("error registering device: " + err);
The code is copied from register_x509.js in azure-iot-sdk-node. The error thrown is "error registering device: ProvisioningRegistrationFailedError: registration failed". Yet if I go to xxx.azureiotcentral.com Device Explorer / Unassociated devices, the device DOES appear there. The error is thrown whether the device was already in that list or whether I delete it first. The cert which signed this device cert has been uploaded and verified and is still valid. What is happening / what should I do about it?