Skip to content

Latest commit

 

History

History
 
 

Samples for the Azure IoT provisioning SDK for Python

This folder contains simple samples showing how to use the various features of the Microsoft Azure IoT Hub provisioning service from a device running Python.

List of samples

  • Simple Sample: shows how to connect to IoT Hub and provision a device.
  • Class Sample using AMQP: shows how to connect to IoT Hub with a ProvisioningManager class and provision a device.

How to run the samples

In order to run the device samples you will first need the following prerequisites:

Note: On Windows, it is recommended to install the azure-iothub-provisioning-device-client module package using pip (see link above).

Once you have a device identity for your sample,

  • Get the sample files:
    • if you have cloned the repository, Navigate to the folder provisioning_device_client/samples
    • if you are using the azure-iothub-provisioning-device-client module installed with pip, download the samples folder content to your target.
  • Run the sample application using the following command to run the simple sample (replacing <id_scope> with provisioning scope):
    provisioning_device_client_sample.py -i < id_scope > -s < TPM|X509 > -p < mqtt|http|amqp >
    

You can get details on the options for the sample command line typing: python provisioning_device_client_sample.py -h python provisioning_device_client_sample_class.py -h