Azure Monitor (HTTP)
In this example, we configure an HTTP connection that publishes twin events to Azure Monitor Data Collector API.
To follow this example you will need:
- A Bosch IoT Things service subscription
- An Azure Monitor Log Analytics Workspace
Create the connection
- Click Go to Dashboard in the row of your Things instance, which will manage the connection.
- On the Things dashboard open the tab Connections/Integrations.
- Click Create your first connection, or Add in case you have one already.
- Select HTTP from the categories.
- Give the connection a name. Setting a name is required.
- Click the Continue button.
- Scroll to the Coordinates section.
- Choose hmac as the credential type.
- Choose az-monitor-2016-04-01 as the algorithm.
- Enter the Workspace ID found on the “Agent Management” tab of the Log Analytics Workspace.
- Enter the primary or secondary shared key of the Log Analytics Workspace.
- Enter the hostname of the Data Collector API
Add a target
- Scroll to the Targets section.
- Click the Add target button.
- Choose POST as the HTTP verb.
- Enter /api/logs?api-version=2016-04-01 as the HTTP path.
- Add an authorization subject, e.g.
- Check Thing twin events under Topics to publish on address.
- Add header mappings
- Click Save new target.
Authorize the connection for twin events
Follow the steps “Create a Hello World thing” and “Add the authorization subject of the connection to the policy” on the Hub-to-Things connection tutorial to authorize the connection to receive twin events.
Remember to use the authorization subject of this connection in the policy, e.g.
Up to 30 minutes after the first event, a custom log
TwinEvent_CL will be created in Azure Monitor.
The rows there are the published twin events.