Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mongoose-os-libs/azure
Azure IoT Hub support library for Mongoose OS
https://github.com/mongoose-os-libs/azure
Last synced: 3 months ago
JSON representation
Azure IoT Hub support library for Mongoose OS
- Host: GitHub
- URL: https://github.com/mongoose-os-libs/azure
- Owner: mongoose-os-libs
- License: other
- Created: 2018-04-10T14:37:40.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-14T14:28:34.000Z (about 1 year ago)
- Last Synced: 2024-07-31T21:51:44.138Z (6 months ago)
- Language: C
- Size: 40 KB
- Stars: 4
- Watchers: 7
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mongoose-os - azure - Azure IoT Hub support library for Mongoose OS (Awesome Mongoose OS [![Awesome](https://awesome.re/badge.svg)](https://awesome.re) / Official Libraries)
README
# Azure IoT Hub support library for Mongoose OS
This library provides [Azure IoT Hub](https://docs.microsoft.com/en-us/azure/iot-hub/) support for Mongoose OS.
Currently only plain MQTT is supported.
See Azure IoT + Mongoose OS tutorial at https://mongoose-os.com/docs/quickstart/cloud/azure.md
## Authentication
Authentication by both SAS token and X.509 certificate is supported. See the [Authentication section](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-security#authentication) of the documentation for explanation.
### `mos azure-iot-setup`
The easiest way to setup Azure cloud connection is by using `mos azure-iot-setup`. Makes sure you have the `az` CLI tool installed, create an IoT Hub, then run:
```
$ mos azure-iot-setup --azure-hub-name MY-HUB-NAME --azure-device-id NEW-DEVICE-ID
```### SAS Token
To use symmetric key authentication, obtain the connection string from the web interface or by using the `az` CLI utility:
```
$ az iot hub device-identity show-connection-string --hub-name my-hub --device-id test1
{
"cs": "HostName=my-hub.azure-devices.net;DeviceId=test1;SharedAccessKey=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}
```Enable the Azure client and set the `azure.cs` config setting:
```
$ mos config-set azure.enable=true "azure.cs=HostName=my-hub.azure-devices.net;DeviceId=test1;SharedAccessKey=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
```### X.509 Certificate
To use authentication by an X.509 certificate, upload the certificate and private key files in PEM format on the device and configure `azure.host_name`, `azure.device_id`, `azure.cert` and `azure.key`:
```
$ mos put test4.crt.pem
$ mos put test4.key.pem
$ mos config-set azure.enable=true azure.host_name=my-hub.azure-devices.net azure.device_id=test4 \
azure.cert=test4.crt.pem azure.key=test4.key.pem```
_Note:_ It is possible to store private key in a cryptochip, such as [ATECC508A](http://www.microchip.com/wwwproducts/en/ATECC508A) (for example, as described [here](https://mongoose-os.com/blog/mongoose-os-google-iot-ecc508a/) for Google IoT Core). Just specify `azure.key=ATCA:0` to use private key in slot 0 of the chip. [mos azure-iot-setup] supports ATECC508 key storage - just add `--use-atca` to the setup command above.