<
From version < 14.1 >
edited by Xiaoling
on 2023/01/05 11:28
To version < 14.2 >
edited by Xiaoling
on 2023/01/05 11:32
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +Azure IoT
Parent
... ... @@ -1,0 +1,1 @@
1 +Main.WebHome
Content
... ... @@ -1,0 +1,178 @@
1 +**Deployment Guide**
2 +
3 +Learn how to deploy the Azure IoT Hub integration for The Things Stack.
4 +
5 +**Prerequisites**
6 +
7 +1. Access to an Azure account. [[Create a new account>>url:https://signup.azure.com/]]
8 +1. An application in The Things Stack. [[See instructions>>url:https://www.thethingsindustries.com/docs/integrations/adding-applications/]]
9 +
10 +**Create API Key**
11 +
12 +Go to your application in The Things Stack Console, navigate to **Integrations → Azure IoT** on the left hand menu and click on **Expand** next to **Azure IoT Hub**. Now click on **Generate API Key**.
13 +
14 +[[image:image-20230105112836-1.png]]
15 +
16 +Copy the generated API key and store it in a safe place, because you will need it in the next section.
17 +
18 +Leave the integration page open, as you will need to copy in your **Azure IoT Hub hostname** and **Azure IoT Hub access key** before saving the integration.
19 +
20 +**Deploy Azure Resource Manager Template**
21 +
22 +[[Deploy template>>url:https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fttsiothubintegration.blob.core.windows.net%2Fintegration-releases%2Flatest%2Fmain.json]]
23 +
24 +View template as [[JSON>>url:https://ttsiothubintegration.blob.core.windows.net/integration-releases/latest/main.json]] or [[Bicep>>url:https://ttsiothubintegration.blob.core.windows.net/integration-releases/latest/main.bicep]]
25 +
26 +**Settings**
27 +
28 +The following parameters configure the integration:
29 +
30 +* **Location**: The region in which the Azure resources will be deployed. Defaults to the region used by the selected Resource Group.
31 +* **Name Suffix**: The suffix added to the Azure Resources. Defaults to a random string.
32 +* **Stack Cluster Address**: The address of your The Things Stack deployment. Can be retrieved from the **Azure IoT** integration page in The Things Stack (see image above).
33 +* **Stack Application ID**: The application ID of your application. Can be retrieved from the **Azure IoT** integration page in The Things Stack (see image above).
34 +* **Stack API Key**: The application API key that you generated in the previous step.
35 +* **Enable fallback route**: Defines if the Azure IoT Hub fallback route should be added. If enabled, uplink messages will be submitted to the default endpoint in your Azure IoT Hub.events
36 +
37 +[[image:image-20230105112836-2.png]]
38 +
39 +Click **Review + Create**, then **Create**.
40 +
41 +**Note:**
42 +
43 +Creating all resources can take up to five minutes. ☕
44 +
45 +When the deployment is done, you’ll see the status .Your deployment is complete
46 +
47 +[[image:image-20230105112836-3.png]]
48 +
49 +After the deployment has finished, click **Outputs**.
50 +
51 +[[image:image-20230105112836-4.png]]
52 +
53 +The two outputs can now be copied into your integration settings as **Azure IoT Hub hostname** and **Azure IoT Hub access key**. Click on **Enable/Update Azure IoT Hub integration**.
54 +
55 +[[image:image-20230105112836-5.png]]
56 +
57 +**Managing Devices**
58 +
59 +The Azure IoT Hub integration for The Things Stack synchronizes the device registry: you can create devices in Azure IoT Hub which trigger an Azure Function that creates the device in The Things Stack.
60 +
61 +**Note:**
62 +
63 +Devices that you create in The Things Stack are automatically created as Azure IoT Hub devices as soon as they activate or send their first uplink message.
64 +
65 +In Azure IoT Hub, create only devices that are not yet in your The Things Stack application.
66 +
67 +**Device Names**
68 +
69 +Devices are created automatically as they join the network or send an uplink message. For the name of new devices, the end device ID in The Things Stack is used as the device ID in Azure IoT Hub.
70 +
71 +**Creating Devices**
72 +
73 +You can use Azure IoT Hub to create and claim devices in The Things Stack. This is useful to manage all your devices in one place, without having to use The Things Stack Console, CLI or API.
74 +
75 +**Creating** a device allows you to add any LoRaWAN device by manually entering its information and security keys.
76 +
77 +In the Azure Console, open your Azure IoT Hub resource. In the menu on the left, click **IoT Devices**.
78 +
79 +Click **Add Device**.
80 +
81 +[[image:image-20230105112836-6.png]]
82 +
83 +As **Device ID**, enter any device ID you like. Hit **Save**.
84 +
85 +**Note:**
86 +
87 +See [[ID and EUI constraints>>url:https://www.thethingsindustries.com/docs/reference/id-eui-constraints/]] for guidelines about choosing a unique ID.
88 +
89 +[[image:image-20230105112836-7.png]]
90 +
91 +You will now have to setup the LoRaWAN specific settings of the device. Click on **Device Twin**.
92 +
93 +[[image:image-20230105112836-8.png]]
94 +
95 +You will now be presented with a JSON document containing the Device Twin. You now have to add a new object called tags, which will contain an object called lorawan with the LoRaWAN specific tags. You will have to specify the following tags:
96 +
97 +* devEui: the hexadecimal LoRaWAN DevEUI.
98 +* joinEui: the hexadecimal LoRaWAN JoinEUI (or AppEUI).
99 +* lorawanVersion: either 1.0, 1.0.1, 1.0.2, 1.0.3 or 1.1.
100 +* regionalParametersVersion: either 1.0, 1.0.1, 1.0.2 (or 1.0.2-a), 1.0.2-b, 1.0.3-a, 1.1-a or 1.1-b.
101 +* appKey: the hexadecimal LoRaWAN AppKey.
102 +* nwkKey: the hexadecimal LoRaWAN NwkKey (only when using LoRaWAN 1.1 or higher).
103 +* frequencyPlanId: the frequency plan ID. See [[Frequency Plans>>url:https://www.thethingsindustries.com/docs/reference/frequency-plans/]] for the supported values.
104 +
105 +If your end device is a part of the [[LoRaWAN Device Repository>>url:https://www.thethingsindustries.com/docs/integrations/payload-formatters/device-repo/]], you may provide the identifiers of the device as part of an optional versionIdentifiers object. You can specify the following information as part of the identifiers:
106 +
107 +* bandId: the band ID.
108 +* brandId: the brand ID.
109 +* firmwareVersion: the firmware version.
110 +* hardwareVersion: the hardware version.
111 +* modelId: the model ID.
112 +
113 +**Note:**
114 +
115 +If the version identifiers are provided, the end device will automatically load the [[Payload Formatters>>url:https://www.thethingsindustries.com/docs/integrations/payload-formatters/]] from [[LoRaWAN Device Repository>>url:https://www.thethingsindustries.com/docs/integrations/payload-formatters/device-repo/]].
116 +
117 +The final JSON tags object should look as follows:
118 +
119 +{
120 +
121 + "lorawan":{
122 +
123 + "devEui":"0004A30B001C5838",
124 +
125 + "joinEui":"800000000000000C",
126 +
127 + "lorawanVersion":"1.0.2",
128 +
129 + "regionalParametersVersion":"1.0.2-b",
130 +
131 + "frequencyPlanId":"EU_863_870_TTN",
132 +
133 + "appKey":"459B77D46A08C427254822A33F6FA1A3",
134 +
135 + "versionIdentifiers":{
136 +
137 + "bandId":"EU_863_870",
138 +
139 + "brandId":"the-things-products",
140 +
141 + "firmwareVersion":"1.0",
142 +
143 + "hardwareVersion":"1.0",
144 +
145 + "modelId":"the-things-node"
146 +
147 + }
148 +
149 + }
150 +
151 +}
152 +
153 +[[image:image-20230105112836-9.png]]
154 +
155 +Click on **Save** in the top-left corner. The end device will now be created in The Things Stack.
156 +
157 +**Deleting Devices**
158 +
159 +In the Azure Console, open your Azure IoT Hub resource. In the menu on the left, click **IoT Devices**.
160 +
161 +Click on the checkbox in front of the device you want to delete, then click **Delete**.
162 +
163 +[[image:image-20230105112836-10.png]]
164 +
165 +The end device will be deleted from Azure IoT Hub and The Things Stack.
166 +
167 +Example(TrackerD):
168 +
169 +[[image:image-20230105112836-11.png]]
170 +
171 +[[image:image-20230105112836-12.png]]
172 +
173 +
174 +Example(LHT65N):
175 +
176 +[[image:image-20230105112836-13.png]]
177 +
178 +[[image:image-20230105112836-14.png]]
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0