Bosch IoT Device Management

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 Console, 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.


images/confluence/download/attachments/2232975794/connections-ui.png

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.

images/confluence/download/thumbnails/2232975794/connection-icons.png

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.

images/confluence/download/attachments/1847337201/create-connection-http.PNG

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

images/confluence/download/attachments/1847337201/az-monitor-coordinates.PNG

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.

    images/confluence/download/attachments/1847337201/az-monitor-target-1.PNG
  • Add an authorization subject, e.g. integration:<solution-id>:az

  • Check Thing twin events under Topics to publish on address.

  • Add header mappings

    • Content-Typeapplication/json

    • Log-TypeTwinEvent images/confluence/download/attachments/1847337201/az-monitor-target-2.PNG

  • 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.