ProvisioningDeviceClient class

Definition

Client which can be used to run the registration of a device with provisioning service using Symmetric Key authentication.

ProvisioningDeviceClient(provisioning_pipeline)
Inheritance
builtins.object
azure.iot.device.provisioning.abstract_provisioning_device_client.AbstractProvisioningDeviceClient
ProvisioningDeviceClient

Methods

cancel()

This is a synchronous call, meaning that this function will not return until the cancellation process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the provisioning service.

In case there is no registration in process it will throw an error as there is no registration process to cancel.

create_from_symmetric_key(provisioning_host, registration_id, id_scope, symmetric_key, protocol_choice=None)

Create a client which can be used to run the registration of a device with provisioning service using Symmetric Key authentication. :param provisioning_host: Host running the Device Provisioning Service. Can be found in the Azure portal in the Overview tab as the string Global device endpoint :param registration_id: The registration ID is used to uniquely identify a device in the Device Provisioning Service. The registration ID is alphanumeric, lowercase string and may contain hyphens. :param id_scope: The ID scope is used to uniquely identify the specific provisioning service the device will register through. The ID scope is assigned to a Device Provisioning Service when it is created by the user and is generated by the service and is immutable, guaranteeing uniqueness. :param symmetric_key: The key which will be used to create the shared access signature token to authenticate the device with the Device Provisioning Service. By default, the Device Provisioning Service creates new symmetric keys with a default length of 32 bytes when new enrollments are saved with the Auto-generate keys option enabled. Users can provide their own symmetric keys for enrollments by disabling this option within 16 bytes and 64 bytes and in valid Base64 format. :param protocol_choice: The choice for the protocol to be used. This is optional and will default to protocol MQTT currently. :return: A ProvisioningDeviceClient which can register via Symmetric Key.

create_from_x509_certificate(provisioning_host, registration_id, id_scope, x509, protocol_choice=None)

Create a client which can be used to run the registration of a device with provisioning service using X509 certificate authentication. :param provisioning_host: Host running the Device Provisioning Service. Can be found in the Azure portal in the Overview tab as the string Global device endpoint :param registration_id: The registration ID is used to uniquely identify a device in the Device Provisioning Service. The registration ID is alphanumeric, lowercase string and may contain hyphens. :param id_scope: The ID scope is used to uniquely identify the specific provisioning service the device will register through. The ID scope is assigned to a Device Provisioning Service when it is created by the user and is generated by the service and is immutable, guaranteeing uniqueness. :param x509: The x509 certificate, To use the certificate the enrollment object needs to contain cert (either the root certificate or one of the intermediate CA certificates). If the cert comes from a CER file, it needs to be base64 encoded. :param protocol_choice: The choice for the protocol to be used. This is optional and will default to protocol MQTT currently. :return: A ProvisioningDeviceClient which can register via Symmetric Key.

register()

Register the device with the with thw provisioning service This is a synchronous call, meaning that this function will not return until the registration process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the provisioning service. If a registration attempt is made while a previous registration is in progress it may throw an error.

cancel()

This is a synchronous call, meaning that this function will not return until the cancellation process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the provisioning service.

In case there is no registration in process it will throw an error as there is no registration process to cancel.

cancel()

create_from_symmetric_key(provisioning_host, registration_id, id_scope, symmetric_key, protocol_choice=None)

Create a client which can be used to run the registration of a device with provisioning service using Symmetric Key authentication. :param provisioning_host: Host running the Device Provisioning Service. Can be found in the Azure portal in the Overview tab as the string Global device endpoint :param registration_id: The registration ID is used to uniquely identify a device in the Device Provisioning Service. The registration ID is alphanumeric, lowercase string and may contain hyphens. :param id_scope: The ID scope is used to uniquely identify the specific provisioning service the device will register through. The ID scope is assigned to a Device Provisioning Service when it is created by the user and is generated by the service and is immutable, guaranteeing uniqueness. :param symmetric_key: The key which will be used to create the shared access signature token to authenticate the device with the Device Provisioning Service. By default, the Device Provisioning Service creates new symmetric keys with a default length of 32 bytes when new enrollments are saved with the Auto-generate keys option enabled. Users can provide their own symmetric keys for enrollments by disabling this option within 16 bytes and 64 bytes and in valid Base64 format. :param protocol_choice: The choice for the protocol to be used. This is optional and will default to protocol MQTT currently. :return: A ProvisioningDeviceClient which can register via Symmetric Key.

create_from_symmetric_key(provisioning_host, registration_id, id_scope, symmetric_key, protocol_choice=None)

Parameters

cls
provisioning_host
registration_id
id_scope
symmetric_key
protocol_choice
default value: None

create_from_x509_certificate(provisioning_host, registration_id, id_scope, x509, protocol_choice=None)

Create a client which can be used to run the registration of a device with provisioning service using X509 certificate authentication. :param provisioning_host: Host running the Device Provisioning Service. Can be found in the Azure portal in the Overview tab as the string Global device endpoint :param registration_id: The registration ID is used to uniquely identify a device in the Device Provisioning Service. The registration ID is alphanumeric, lowercase string and may contain hyphens. :param id_scope: The ID scope is used to uniquely identify the specific provisioning service the device will register through. The ID scope is assigned to a Device Provisioning Service when it is created by the user and is generated by the service and is immutable, guaranteeing uniqueness. :param x509: The x509 certificate, To use the certificate the enrollment object needs to contain cert (either the root certificate or one of the intermediate CA certificates). If the cert comes from a CER file, it needs to be base64 encoded. :param protocol_choice: The choice for the protocol to be used. This is optional and will default to protocol MQTT currently. :return: A ProvisioningDeviceClient which can register via Symmetric Key.

create_from_x509_certificate(provisioning_host, registration_id, id_scope, x509, protocol_choice=None)

Parameters

cls
provisioning_host
registration_id
id_scope
x509
protocol_choice
default value: None

register()

Register the device with the with thw provisioning service This is a synchronous call, meaning that this function will not return until the registration process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the provisioning service. If a registration attempt is made while a previous registration is in progress it may throw an error.

register()