Azure Monitor - HTTP connection
Publish twin events to Azure Monitor as custom log.
In this example, we configure an HTTP connection that publishes twin events to Azure Monitor Data Collector API.
Table of contents:
Prerequisites
To follow this example you will need:
A Bosch IoT Things service subscription
An Azure Monitor Log Analytics Workspace
Create the connection
Starting at the Bosch IoT Suite UI, click the Connection entry in the left navigation.
In case it is not there, use the search, and click the star icon to pin it to your navigation bar.
Please make sure, that your connections are active. This is indicated with the plug symbol: in the example below the first connection is open and will work, the second one is disabled.
If one of your connections are closed, just open them.
Click Add to create a new connection.
Select HTTP from the categories.
Give the connection a name. Setting a name is required.
Click the Continue button.
Configure credentials
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 <workspace-id>.ods.opinsights.azure.com
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. integration:<solution-id>:az
Check Thing twin events under Topics to publish on address.
Add header mappings
Content-Type ⇾ application/json
Log-Type ⇾ TwinEvent
Click Save new target.
Authorize the connection for twin events
Follow the steps Add a policy entry for public cloud connections.
Replace xxx from that example with the authorization subject of this connection in the policy, e.g. integration:<solution-id>:az.
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.