You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/industry/agriculture/ingest-historical-telemetry-data-in-azure-farmbeats.md
+22-18Lines changed: 22 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,36 +15,35 @@ Ingesting historical data from Internet of Things (IoT) resources such as device
15
15
16
16
## Before you begin
17
17
18
-
Before you proceed with this article, make sure that you've installed FarmBeats and collected historical data from your IoT devices.
19
-
You also need to enable partner access as mentioned in the following steps.
18
+
Before you proceed with this article, make sure that you've installed FarmBeats and collected historical data from your IoT devices. You also need to enable partner access as mentioned in the following steps.
20
19
21
20
## Enable partner access
22
21
23
22
You need to enable partner integration to your Azure FarmBeats instance. This step creates a client that has access to your Azure FarmBeats instance as your device partner and provides you with the following values that are required in the subsequent steps:
24
23
25
-
- API endpoint: This is the Datahub URL, for example, https://\<datahub>.azurewebsites.net.
24
+
- API endpoint: This is the Datahub URL, for example, https://\<datahub>.azurewebsites.net
26
25
- Tenant ID
27
26
- Client ID
28
27
- Client secret
29
28
- EventHub connection string
30
29
31
-
Follow these steps.
30
+
Follow these steps:
32
31
33
32
>[!NOTE]
34
33
> You must be an administrator to do the following steps.
35
34
36
35
1. Download the [zip file](https://aka.ms/farmbeatspartnerscriptv2), and extract it to your local drive. There will be one file inside the zip file.
37
-
2. Sign in to https://portal.azure.com/ and go to Azure Active Directory -> App Registrations
36
+
2. Sign in to https://portal.azure.com/ and go to **Azure Active Directory** > **App Registrations**.
38
37
39
-
3.Click on the App Registration that was created as part of your FarmBeats deployment. It will have the same name as your FarmBeats Datahub.
38
+
3.Select the **App Registration** that was created as part of your FarmBeats deployment. It will have the same name as your FarmBeats Datahub.
40
39
41
-
4.Click on “Expose an API” -> Click “Add a client application” and enter **04b07795-8ddb-461a-bbee-02f9e1bf7b46** and check "Authorize Scope". This will give access to the Azure CLI (Cloud Shell) to perform the below steps.
40
+
4.Select **Expose an API** > Select **Add a client application** and enter **04b07795-8ddb-461a-bbee-02f9e1bf7b46** and check **Authorize Scope**. This will give access to the Azure CLI (Cloud Shell) to perform the following steps:
42
41
43
42
5. Open Cloud Shell. This option is available on the toolbar in the upper-right corner of the Azure portal.
8. Go to the directory where the file was uploaded. By default, files get uploaded to the home directory under the username.
56
55
57
-
9. Run the following script. The script asks for the Tenant ID which can be obtained from Azure Active Directory -> Overview page.
56
+
9. Run the following script. The script asks for the Tenant ID, which can be obtained from **Azure Active Directory** > **Overview page**.
58
57
59
-
```azurepowershell-interactive
58
+
```azurepowershell-interactive
60
59
61
60
./generatePartnerCredentials.ps1
62
61
@@ -65,9 +64,12 @@ Follow these steps.
65
64
10. Follow the onscreen instructions to capture the values for **API Endpoint**, **Tenant ID**, **Client ID**, **Client Secret**, and **EventHub Connection String**.
66
65
## Create device or sensor metadata
67
66
68
-
Now that you have the required credentials, you can define the device and sensors. To do this, create the metadata by calling FarmBeats APIs. Please note you will need to call the APIs as the client app that you created in the above section
67
+
Now that you have the required credentials, you can define the device and sensors. To do this, create the metadata by calling FarmBeats APIs. Make sure to call the APIs as the client app that you created in the above section.
69
68
70
-
FarmBeats Datahub has the following APIs that enable creation and management of device or sensor metadata. Please note that as a partner you have access to only read, create and update the metadata; **Delete is not allowed by a partner.**
69
+
FarmBeats Datahub has the following APIs that enable creation and management of device or sensor metadata.
70
+
71
+
> [!NOTE]
72
+
> As a partner you have access only to read, create and update the metadata; **delete option is restricted to the partner.**
71
73
72
74
- /**DeviceModel**: DeviceModel corresponds to the metadata of the device, such as the manufacturer and the type of device, which is either a gateway or a node.
73
75
- /**Device**: Device corresponds to a physical device present on the farm.
@@ -279,7 +281,7 @@ curl -X POST "https://<datahub>.azurewebsites.net/Device" -H
279
281
\"description\": \"Test Device 123\"}"*
280
282
```
281
283
282
-
Below is a sample code in Python. Please note that the access token used in this sample is the same that we received during authentication
284
+
Below is a sample code in Python. The access token used in this sample is the same that is received during the authentication.
283
285
284
286
```python
285
287
import requests
@@ -342,11 +344,11 @@ Convert the historical sensor data format to a canonical format that Azure FarmB
342
344
"sensordata": [
343
345
{
344
346
"timestamp": "< timestamp in ISO 8601 format >",
345
-
"<sensor measure name (as defined in the Sensor Model)>": <value>
347
+
"<sensor measure name (as defined in the Sensor Model)>": "<value>"
346
348
},
347
349
{
348
350
"timestamp": "<timestamp in ISO 8601 format>",
349
-
"<sensor measure name (as defined in the Sensor Model)>": <value>
351
+
"<sensor measure name (as defined in the Sensor Model)>": "<values>"
350
352
}
351
353
]
352
354
}
@@ -403,8 +405,10 @@ Here's an example of a telemetry message:
403
405
404
406
**Corrective action**:
405
407
406
-
1. Ensure you have done the partner registration correctly - you can check this by going to your datahub swagger, navigate to /Partner API, Do a Get and check if the partner is registered. If not, please follow the [steps here](get-sensor-data-from-sensor-partner.md#enable-device-integration-with-farmbeats) to add partner.
408
+
1. Ensure you have done the appropriate partner registration - you can check this by going to your datahub swagger, navigate to /Partner API, Do a Get and check if the partner is registered. If not, follow the [steps here](get-sensor-data-from-sensor-partner.md#enable-device-integration-with-farmbeats) to add partner.
409
+
407
410
2. Ensure that you have created the metadata (DeviceModel, Device, SensorModel, Sensor) using the partner client credentials.
411
+
408
412
3. Ensure that you have used the correct Telemetry message format (as specified below):
409
413
410
414
```json
@@ -418,11 +422,11 @@ Here's an example of a telemetry message:
418
422
"sensordata": [
419
423
{
420
424
"timestamp": "< timestamp in ISO 8601 format >",
421
-
"<sensor measure name (as defined in the Sensor Model)>": <value>
425
+
"<sensor measure name (as defined in the Sensor Model)>": "<value>"
422
426
},
423
427
{
424
428
"timestamp": "<timestamp in ISO 8601 format>",
425
-
"<sensor measure name (as defined in the Sensor Model)>": <value>
429
+
"<sensor measure name (as defined in the Sensor Model)>": "<value>"
0 commit comments