Hide last authors
Xiaoling 14.3 1 **Table of Contents:**
Xiaoling 14.2 2
Xiaoling 16.2 3 {{toc/}}
Xiaoling 14.3 4
5
6
7
Xiaoling 16.2 8
Xiaoling 14.3 9 = 1. Deployment Guide =
10
11
Xiaoling 14.2 12 Learn how to deploy the Azure IoT Hub integration for The Things Stack.
13
14
Xiaoling 14.3 15 == 1.1 Prerequisites ==
16
17
Xiaoling 16.2 18 1.  Access to an Azure account. [[Create a new account>>url:https://signup.azure.com/]]
Xiaoling 14.3 19
Xiaoling 16.2 20 2. An application in The Things Stack. [[See instructions>>url:https://www.thethingsindustries.com/docs/integrations/adding-applications/]]
Xiaoling 14.2 21
Xiaoling 16.2 22
Xiaoling 14.3 23 == 1.2 Create API Key ==
Xiaoling 14.2 24
25
Xiaoling 14.3 26 Go to your application in The Things Stack Console, navigate to (% style="color:blue" %)**Integrations → Azure IoT**(%%) on the left hand menu and click on (% style="color:blue" %)**Expand** (%%)next to (% style="color:blue" %)**Azure IoT Hub**(%%). Now click on (% style="color:blue" %)**Generate API Key**.
27
28
Xiaoling 14.2 29 [[image:image-20230105112836-1.png]]
30
Xiaoling 14.3 31
Xiaoling 14.2 32 Copy the generated API key and store it in a safe place, because you will need it in the next section.
33
Xiaoling 14.3 34 Leave the integration page open, as you will need to copy in your (% style="color:blue" %)**Azure IoT Hub hostname** (%%)and (% style="color:blue" %)**Azure IoT Hub access key**(%%) before saving the integration.
Xiaoling 14.2 35
36
Xiaoling 14.3 37 == 1.3 Deploy Azure Resource Manager Template ==
38
39
Xiaoling 14.2 40 [[Deploy template>>url:https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fttsiothubintegration.blob.core.windows.net%2Fintegration-releases%2Flatest%2Fmain.json]]
41
42 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]]
43
44
Xiaoling 14.3 45 == 1.4 Settings ==
46
47
Xiaoling 14.2 48 The following parameters configure the integration:
49
Xiaoling 14.3 50 * (% style="color:#037691" %)**Location**(%%): The region in which the Azure resources will be deployed. Defaults to the region used by the selected Resource Group.
Xiaoling 14.2 51
Xiaoling 14.3 52 * (% style="color:#037691" %)**Name Suffix**(%%): The suffix added to the Azure Resources. Defaults to a random string.
53
54 * (% style="color:#037691" %)**Stack Cluster Address**(%%): The address of your The Things Stack deployment. Can be retrieved from the (% style="color:blue" %)**Azure IoT**(%%) integration page in The Things Stack (see image above).
55
56 * (% style="color:#037691" %)**Stack Application ID**(%%): The application ID of your application. Can be retrieved from the (% style="color:blue" %)**Azure IoT** (%%)integration page in The Things Stack (see image above).
57
58 * (% style="color:#037691" %)**Stack API Key**(%%): The application API key that you generated in the previous step.
59
60 * (% style="color:#037691" %)**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
61
Xiaoling 14.2 62 [[image:image-20230105112836-2.png]]
63
Xiaoling 16.2 64 Click (% style="color:blue" %)**Review + Create**(%%), then (% style="color:blue" %)**Create**.
Xiaoling 14.2 65
66
Xiaoling 14.3 67 (% style="color:red" %)**Note:**
68
Xiaoling 14.2 69 Creating all resources can take up to five minutes. ☕
70
Xiaoling 16.2 71 When the deployment is done, you’ll see the status .Your deployment is complete.
Xiaoling 14.2 72
Xiaoling 16.2 73
Xiaoling 14.2 74 [[image:image-20230105112836-3.png]]
75
76
Xiaoling 14.3 77 After the deployment has finished, click (% style="color:blue" %)**Outputs**.
78
Xiaoling 16.2 79 [[image:image-20230105135055-2.png]]
Xiaoling 14.2 80
81
Xiaoling 16.2 82 The two outputs can now be copied into your integration settings as (% style="color:blue" %)**Azure IoT Hub hostname**(%%) and (% style="color:blue" %)**Azure IoT Hub access key**(%%). Click on (% style="color:blue" %)**Enable/Update Azure IoT Hub integration**.
83
Xiaoling 14.2 84 [[image:image-20230105112836-5.png]]
85
86
Xiaoling 14.3 87 = 2. Managing Devices =
88
89
Xiaoling 14.2 90 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.
91
92
Xiaoling 14.3 93 (% style="color:red" %)**Note:**
94
Xiaoling 14.2 95 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.
96
97 In Azure IoT Hub, create only devices that are not yet in your The Things Stack application.
98
99
Xiaoling 14.3 100 (% style="color:blue" %)**Device Names:**
101
Xiaoling 14.2 102 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.
103
104
Xiaoling 16.2 105 == 2.1 Creating Devices ==
Xiaoling 14.3 106
Xiaoling 16.2 107
Xiaoling 14.2 108 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.
109
Xiaoling 14.3 110 (% style="color:blue" %)**Creating**(%%) a device allows you to add any LoRaWAN device by manually entering its information and security keys.
Xiaoling 14.2 111
Xiaoling 14.3 112 In the Azure Console, open your Azure IoT Hub resource. In the menu on the left, click (% style="color:blue" %)**IoT Devices**.
Xiaoling 14.2 113
Xiaoling 14.3 114 Click (% style="color:blue" %)**Add Device**.
Xiaoling 14.2 115
116 [[image:image-20230105112836-6.png]]
117
Xiaoling 16.2 118
Xiaoling 14.3 119 As (% style="color:blue" %)**Device ID**(%%), enter any device ID you like. Hit (% style="color:blue" %)**Save**.
Xiaoling 14.2 120
Xiaoling 16.2 121
Xiaoling 14.3 122 (% style="color:red" %)**Note:**
Xiaoling 14.2 123
124 See [[ID and EUI constraints>>url:https://www.thethingsindustries.com/docs/reference/id-eui-constraints/]] for guidelines about choosing a unique ID.
125
126 [[image:image-20230105112836-7.png]]
127
Xiaoling 16.2 128
Xiaoling 14.3 129 You will now have to setup the LoRaWAN specific settings of the device. Click on (% style="color:blue" %)**Device Twin**.
Xiaoling 14.2 130
Xiaoling 16.2 131 [[image:image-20230105134348-1.png]]
Xiaoling 14.2 132
Xiaoling 16.2 133
Xiaoling 14.2 134 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:
135
Xiaoling 16.2 136 * (% style="color:#037691" %)**devEui:**(%%) the hexadecimal LoRaWAN DevEUI.
Xiaoling 14.2 137
Xiaoling 16.2 138 * (% style="color:#037691" %)**joinEui:**(%%)** **the hexadecimal LoRaWAN JoinEUI (or AppEUI).
Xiaoling 14.3 139
Xiaoling 16.2 140 * (% style="color:#037691" %)**lorawanVersion:**(%%) either 1.0, 1.0.1, 1.0.2, 1.0.3 or 1.1.
Xiaoling 14.3 141
Xiaoling 16.2 142 * (% style="color:#037691" %)**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.
Xiaoling 14.3 143
Xiaoling 16.2 144 * (% style="color:#037691" %)**appKey:**(%%) the hexadecimal LoRaWAN AppKey.
Xiaoling 14.3 145
Xiaoling 16.2 146 * (% style="color:#037691" %)**nwkKey:**(%%) the hexadecimal LoRaWAN NwkKey (only when using LoRaWAN 1.1 or higher).
Xiaoling 14.3 147
Xiaoling 16.2 148 * (% style="color:#037691" %)**frequencyPlanId:**(%%) the frequency plan ID. See [[Frequency Plans>>url:https://www.thethingsindustries.com/docs/reference/frequency-plans/]] for the supported values.
Xiaoling 14.3 149
Xiaoling 14.2 150 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:
151
Xiaoling 16.2 152 * (% style="color:#037691" %)**bandId:**(%%) the band ID.
Xiaoling 14.2 153
Xiaoling 16.2 154 * (% style="color:#037691" %)**brandId:**(%%) the brand ID.
Xiaoling 14.2 155
Xiaoling 16.2 156 * (% style="color:#037691" %)**firmwareVersion:**(%%) the firmware version.
Xiaoling 14.3 157
Xiaoling 16.2 158 * (% style="color:#037691" %)**hardwareVersion:**(%%) the hardware version.
Xiaoling 14.3 159
Xiaoling 16.2 160 * (% style="color:#037691" %)**modelId:**(%%) the model ID.
Xiaoling 14.3 161
Xiaoling 16.2 162
Xiaoling 14.3 163 (% style="color:red" %)**Note:**
164
Xiaoling 14.2 165 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/]].
166
167 The final JSON tags object should look as follows:
168
169 {
170
171 "lorawan":{
172
173 "devEui":"0004A30B001C5838",
174
175 "joinEui":"800000000000000C",
176
177 "lorawanVersion":"1.0.2",
178
179 "regionalParametersVersion":"1.0.2-b",
180
181 "frequencyPlanId":"EU_863_870_TTN",
182
183 "appKey":"459B77D46A08C427254822A33F6FA1A3",
184
185 "versionIdentifiers":{
186
187 "bandId":"EU_863_870",
188
189 "brandId":"the-things-products",
190
191 "firmwareVersion":"1.0",
192
193 "hardwareVersion":"1.0",
194
195 "modelId":"the-things-node"
196
197 }
198
199 }
200
201 }
202
Xiaoling 16.2 203
Xiaoling 14.2 204 [[image:image-20230105112836-9.png]]
205
Xiaoling 14.3 206 Click on (% style="color:blue" %)**Save**(%%) in the top-left corner. The end device will now be created in The Things Stack.
Xiaoling 14.2 207
208
Xiaoling 16.2 209 == 2.2 Deleting Devices ==
210
211
Xiaoling 14.3 212 In the Azure Console, open your Azure IoT Hub resource. In the menu on the left, click (% style="color:blue" %)**IoT Devices**.
Xiaoling 14.2 213
Xiaoling 14.3 214 Click on the checkbox in front of the device you want to delete, then click (% style="color:blue" %)**Delete**.
Xiaoling 14.2 215
216 [[image:image-20230105112836-10.png]]
217
218 The end device will be deleted from Azure IoT Hub and The Things Stack.
219
220
Xiaoling 16.2 221 (% style="color:blue" %)**Example(TrackerD):**
222
Xiaoling 14.2 223 [[image:image-20230105112836-11.png]]
224
Xiaoling 16.2 225
Xiaoling 14.2 226 [[image:image-20230105112836-12.png]]
227
228
Xiaoling 16.2 229 (% style="color:blue" %)**Example(LHT65N):**
Xiaoling 14.2 230
Xiaoling 18.2 231 [[image:image-20230105135558-2.png||height="495" width="1360"]]
Xiaoling 14.2 232
Xiaoling 16.2 233
Xiaoling 14.2 234 [[image:image-20230105112836-14.png]]
Copyright ©2010-2024 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0