Merge pull request #35 from Azure/preview-readme-update
Add support and docs for preview applications
This commit is contained in:
Коммит
a8ca48e3fb
|
@ -74,27 +74,6 @@ function validateMeasurements(measurements) {
|
|||
return false;
|
||||
}
|
||||
|
||||
for (const field in measurements) {
|
||||
if (typeof measurements[field] !== 'number' && typeof measurements[field] !== 'string' && !isLocation(measurements[field])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns true if a measurement is a location.
|
||||
*/
|
||||
function isLocation(measurement) {
|
||||
if (!measurement || typeof measurement !== 'object' || typeof measurement.lat !== 'number' || typeof measurement.lon !== 'number') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('alt' in measurement && typeof measurement.alt !== 'number') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
23
README.md
23
README.md
|
@ -12,12 +12,12 @@ Take the following steps to deploy an Azure Function into your subscription and
|
|||
|
||||
1. Click the `Deploy to Azure` button above. This opens up a custom ARM template in the Azure Portal to deploy the Azure Function.
|
||||
|
||||
1. Go to your IoT Central application, and navigate to the `Administration > Device Connection` area.
|
||||
- Copy the `Scope ID` and paste it into the `Scope ID` field the custom template.
|
||||
- Copy one of the SAS keys, so either the `Primary Key` or the `Secondary Key`, and paste it into the `Iot Central SAS Key` field. (this key will be stored in a Key Vault
|
||||
2. Go to your IoT Central application, and navigate to the `Administration > Device Connection` area.
|
||||
- Copy the `ID Scope` and paste it into the `Scope ID` field the custom template.
|
||||
- In the same page, under the `Devices` tab, click `View Keys`. Copy either the `Primary key` or the `Secondary key` and paste it into the `Iot Central SAS Key` field. (this key will be stored in a Key Vault
|
||||
provisioned with the function).
|
||||
|
||||
![Scope ID and key](assets/scopeIdAndKey.PNG "Scope ID and key")
|
||||
![ID Scope and key](assets/scopeIdAndKey.PNG "ID Scope and key")
|
||||
|
||||
3. After the deployment is done, install the required NPM packages in the function. To do this,
|
||||
go to the Function App that was deployed to your subscription in the `Functions > IoTCIntegration > Console` tab.
|
||||
|
@ -53,14 +53,19 @@ An optional `timestamp` field can be included in the body, to specify the UTC da
|
|||
This field must be in ISO format (e.g., YYYY-MM-DDTHH:mm:ss.sssZ). If `timestamp` is not provided,
|
||||
the current date and time will be used.
|
||||
|
||||
> NOTE: `deviceId` must be alphanumeric, lowercase, and may contain hyphens. The values of the fields in `measurements` must be numbers or strings.
|
||||
> NOTE: `deviceId` must be alphanumeric, lowercase, and may contain hyphens. For preview applications, the keys of the fields in `measurements` must match the name of a capability.
|
||||
|
||||
6. When a message with a new `deviceId` is sent to IoT Central by the device bridge, a device will be created as an **Unassociated device**. Unassociated devices appear in your IoT Central application in `Device Explorer > Unassociated devices`. Click `Associate` and choose a device template to start receiving incoming measurements from that device in IoT Central.
|
||||
|
||||
> NOTE: Until the device is associated to a template, HTTP calls to the function will return a 403 error status.
|
||||
6. When a message with a new `deviceId` is sent to IoT Central by the device bridge, a new _unassociated device_ will be created:
|
||||
- **Legacy applications (2018):** the new device will appear in your IoT Central application in `Device Explorer > Unassociated devices`. Click `Associate` and choose a device template to start receiving incoming measurements from that device in IoT Central.
|
||||
|
||||
![Associate device](assets/associate.PNG "Associate device")
|
||||
|
||||
- **Preview applications:** the device will initially be under `Devices > All devices`. Select the device then click `migrate` to choose the appropriate template.
|
||||
|
||||
![Migrate device](assets/migrate.PNG "Associate device")
|
||||
|
||||
> NOTE: Until the device is associated to a template, HTTP calls to the function will return a 403 error status.
|
||||
|
||||
## What is being provisioned? (pricing)
|
||||
The custom template in this repository will provision the following Azure resources:
|
||||
- Key Vault, needed to store your IoT Central key
|
||||
|
@ -250,7 +255,7 @@ Function. You can check the integrity of the code being deployed by verifying th
|
|||
of the `iotc-bridge-az-function.zip` file in the root of this repository matches the following:
|
||||
|
||||
```
|
||||
EAEF80420054196F05F7D36E436BA168AF5DCD7A6E31753C8A86F71607C39312
|
||||
4A3CF7179FF0B0AB6A070F596C3B8746EF1A0BA9BE51BD9952AE04047281D6DC
|
||||
```
|
||||
|
||||
# Contributing
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 35 KiB |
Двоичные данные
assets/scopeIdAndKey.PNG
Двоичные данные
assets/scopeIdAndKey.PNG
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 50 KiB После Ширина: | Высота: | Размер: 60 KiB |
Двоичные данные
iotc-bridge-az-function.zip
Двоичные данные
iotc-bridge-az-function.zip
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче