Changes

no edit summary
Line 1: Line 1: −
   
<b>Azure IoT Hub</b> is an open and flexible cloud platform that supports open-source SDKs and multiple protocols.
 
<b>Azure IoT Hub</b> is an open and flexible cloud platform that supports open-source SDKs and multiple protocols.
   Line 88: Line 87:  
</ul>
 
</ul>
   −
==Configuring Azure IoT Hub on RutOS==
+
==Configuring RUTX Azure IoT Hub==
To configure an Azure IoT Hub instance on a RUT device, it is essential to first install the Azure IoT Hub package via the package manager.
  −
<ul>
  −
<li>To install required package, please on the router WebUI, navigate '''System > Package Manager''' and install Azure IoT Hub package </li>
  −
[[File:Azure RutOSconf 1.png|border|class=tlt-border]]
  −
</ul>
  −
Now navigate to ''' Services > Cloud solutions > Azure IoT Hub''' and add a new instance. In the pop-up window, you will notice two different connection types available:
  −
<ul> <li> Shared Access signature (SAS) key </li>
  −
<li> Device Provisioning Service (DPS) </li> </ul>
  −
In this article, we will demonstrate the configuration steps for both connection types.
  −
===SAS key connection type configuration===
  −
Configuring Azure IoT Hub using the SAS key connection type is quite simple and straightforward. Please follow these three steps:
  −
<div>1. Make sure to enable the instance by pressing '''Enable''' button </div>
  −
<div>2. Paste previously copied '''Connection String'''</div>
  −
<div>3. Press '''Save & Apply''' button </div>
  −
[[File:Azure RutOSconf 2.2.png|border|class=tlt-border]]
  −
</ul>
  −
After the instance is correctly configured, you will be able to see the connection status on the Azure IoT Hub page of the WebUI. A green dot indicates that the connection is successful.
  −
[[File:Azure RutOSconf 3.png|border|class=tlt-border]]
  −
Additionally, you can check the connection status through the router command line by executing the following command:
  −
ubus call azure.1 get_connection_status
  −
Upon executing this command, you will see its output. If the connection is successful, you will see the following output:
  −
[[File:Azure RutOSconf 4.png|border|class=tlt-border]]
  −
 
  −
If you are able to see that the connection status is succesfully and authorized it means that connection is established using SAS key connection type. Now, lets move foward with configuration of Device Provisioning Service (DPS) connection type.
  −
 
  −
===Device Provisioning Service (DPS) configuration===
  −
One of the primary features of DPS is its capability to dynamically manage multiple device identities. This service manages the device identity creation process using mechanisms called attestations. There are two such mechanisms:
  −
<ul>
  −
<li> 1. X.509 </li>
  −
<li> 2. Symmetric keys </li>
  −
</ul>
  −
====X.509 mechanism====
  −
The first mechanism utilizes X.509 certificates. Each DPS service includes one or more services known as enrollment groups, which handle this task. Each enrollment group is configured to function with a specific IoT Hub, considering there may be multiple IoT Hubs. At the DPS, the root CA certificate needs to be registered. Additionally, each enrollment group should have one or more intermediate CAs that are signed by the root CA. Each RUT device must have a unique certificate signed by an intermediate CA. This certificate contains additional information, such as the subject ID field, which will serve as the device identity name on the IoT Hub. Now, let's delve into an actual example of configuring such a service.
  −
 
   
<ul>
 
<ul>
<div> 1. The initial step is to generate certificates. You can refer to the Microsoft guide to generate the required certificates successfully. The Microsoft guide can be found here: https://learn.microsoft.com/en-us/azure/iot-dps/tutorial-custom-hsm-enrollment-group-x509?pivots=programming-language-ansi-c#create-a-root-ca-certificate 
+
<li>First open router WebUI, go to '''System > Package Manager''' and install Azure IoT Hub package </li>
The required certificates and keys:
+
[[File:Networking_rutx_configuration_examples_package_manager_v1.png|border|class=tlt-border]]
<li> Root CA certificate </li>
  −
<li> Intermediate CA certificate </li>
  −
<li> Devices certificates </li>
  −
 
  −
Please ensure to carefully follow the Microsoft guide to create certificates, making sure not to miss any steps as they are all crucial.
     −
Following the Microsoft guide, after creating the Root CA certificate, you will notice that it is named "Azure IoT Hub CA Cert Test Only".
+
<li>Now navigate to ''' Services > Cloud solutions > Azure IoT Hub''' </li>
[[File:Azure RutOSconf 5.png|border|class=tlt-border]]
+
<div>1. Select Enable '''Azure IoT Hub monitoring'''</div>
After creating the root CA certificate, an intermediate CA certificate must be generated. Upon inspecting this certificate, you should notice that it is issued by the "Azure IoT Hub CA Cert Test Only", as seen previously.
+
<div>2. Paste previously copied Connection String (For this test we leave other values as default)</div>
[[File:Azure RutOSconf 6.png|border|class=tlt-border]]
+
<div>3. Select what kind of information you want to send to Azure IoT Hub</div>
After successfully creating the intermediate CA certificate, proceed with creating the device certificate and signing it using the intermediate authority. It's crucial to note that the subject field will be the name of the newly registered identity on the IoT Hub page. If you are following the provided Microsoft guide, you can observe "device-01" name, remember it as it will be used in later configurations steps.
+
<div>4. Press '''Save''' </div>
[[File:Azure RutOSconf 7.png|border|class=tlt-border]]
+
[[File:Networking_rutx_configuration_examples_azure_iot_hub_v1.png|border|class=tlt-border]]
 
  −
Finally, we append the root CA, intermediate CA, and device certificates into one certificate chain. If you are following the guide, the "device-01-full-chain.cert.pem" file will be created. Later, we will upload this file to the RUT device WebUI page.
  −
</div>
  −
<div>
  −
2. After succesfully generating certificates, head back to the Azure portal page and navigate to your Azure Iot Hub Device Provisioning Service (DPS) page. There, proceed to the certificate page and upload the root CA file.  
  −
[[File:Azure RutOSconf 8.png|border|class=tlt-border]]
  −
</div>
      
</ul>
 
</ul>
   
==Checking if Data reaches Azure IoT Hub==
 
==Checking if Data reaches Azure IoT Hub==
 
<ul>
 
<ul>