Skip to content

Commit f43c8fe

Browse files
authored
Merge pull request #289765 from dominicbetts/release-aio-ga-media-connectors
AIO: Media connector previews
2 parents 2140106 + 7cfdb52 commit f43c8fe

15 files changed

+1565
-82
lines changed

articles/iot-operations/connect-to-cloud/overview-dataflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ By using dataflows, you can efficiently manage your data paths. You can ensure t
6060

6161
## Schema registry
6262

63-
Schema registry, a feature provided by Azure Device Registry, is a synchronized repository in the cloud and at the edge. The schema registry stores the definitions of messages coming from edge assets, and then exposes an API to access those schemas at the edge. Southbound connectors like the OPC UA connector can create message schemas and add them to the schema registry or customers can upload schemas to the operations experience web UI.
63+
Schema registry, a feature provided by Azure Device Registry, is a synchronized repository in the cloud and at the edge. The schema registry stores the definitions of messages coming from edge assets, and then exposes an API to access those schemas at the edge. Southbound connectors like the connector for OPC UA can create message schemas and add them to the schema registry or customers can upload schemas to the operations experience web UI.
6464

6565
Dataflows uses messages schemas to transform the message into the format expected by the destination endpoint.
6666

articles/iot-operations/deploy-iot-ops/howto-deploy-iot-operations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In this article, we discuss Azure IoT Operations *deployments* and *instances*,
2222
* Custom locations
2323
* Resources that you can configure in your Azure IoT Operations solution, like assets and asset endpoints.
2424

25-
* An Azure IoT Operations *instance* is the parent resource that bundles the suite of services that are defined in [What is Azure IoT Operations?](../overview-iot-operations.md) like MQTT broker, dataflows, and OPC UA connector.
25+
* An Azure IoT Operations *instance* is the parent resource that bundles the suite of services that are defined in [What is Azure IoT Operations?](../overview-iot-operations.md) like MQTT broker, dataflows, and connector for OPC UA.
2626

2727
When we talk about deploying Azure IoT Operations, we mean the full set of components that make up a *deployment*. Once the deployment exists, you can view, manage, and update the *instance*.
2828

articles/iot-operations/discover-manage-assets/concept-assets-asset-endpoints.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,29 @@ You can create, edit, and delete asset endpoints and assets by using the Azure I
2828

2929
Before you can create an asset, you need to define an asset endpoint profile. An *asset endpoint* is a profile that describes southbound edge connectivity information for one or more assets.
3030

31-
Currently, the only southbound connector available in Azure IoT Operations is the connector for OPC UA. Asset endpoints are configurations for the connector for OPC UA that tell it how to connect to an OPC UA server. For more information, see [What is the connector for OPC UA?](./overview-opcua-broker.md)
31+
Currently, the only southbound connectors available in Azure IoT Operations are the connector for OPC UA, the media connector (preview), and the connector for ONVIF (preview). Asset endpoints are configurations for a connector that enable it to connect to an asset. For example:
32+
33+
- An asset endpoint for OPC UA stores the information you need to connect to an OPC UA server.
34+
- An asset endpoint for the media connector stores the information you need to connect to a media source.
35+
36+
For more information, see [What is the connector for OPC UA?](./overview-opcua-broker.md)
3237

3338
The following table highlights some important properties that are included in an asset endpoint definition.
3439

3540
| Property | Description |
3641
| -------- | ----------- |
3742
| **Cluster** or **Location** | The custom location or cluster name for the Azure IoT Operations instance where the asset endpoint custom resource will be created. In the operations experience, this property is set by choosing the instance before you create the asset endpoint. |
38-
| **Target address** | The local IP address of the OPC UA server. |
43+
| **Target address** | The local IP address of the OPC UA server or IP camera. |
3944
| **User authentication** | Can be anonymous authentication or username/password authentication. For username/password authentication, provide pointers to where both values are stored as secrets in Azure Key Vault. |
4045

4146
## Assets
4247

4348
An *asset* is a logical entity that represents a device or component in the cloud as an Azure Resource Manager resource and at the edge as a Kubernetes custom resource. When you create an asset, you can define its metadata and the datapoints (also called tags) and events that it emits.
4449

45-
Currently, an asset in Azure IoT Operations can be anything that connects to an OPC UA server.
50+
Currently, an asset in Azure IoT Operations can be an:
51+
52+
- Something connected to an OPC UA server such as a robotic arm.
53+
- A media source such as a camera.
4654

4755
When you define an asset using either the operations experience or Azure IoT Operations CLI, you can configure *tags* and *events* for each asset.
4856

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
---
2+
title: How to use the media connector (preview)
3+
description: How to use the media connector (preview) to perform tasks such as sending an image snapshot to the MQTT broker or saving a video stream to a local file system.
4+
author: dominicbetts
5+
ms.author: dobett
6+
ms.service: azure-iot-operations
7+
ms.topic: how-to
8+
ms.date: 10/07/2024
9+
10+
#CustomerIntent: As an industrial edge IT or operations user, I want to configure the media connector so that I can access snapshots and videos from a media source such as a IP video camera.
11+
---
12+
13+
# Configure the media connector (preview)
14+
15+
In Azure IoT Operations, the media connector (preview) enables access to media from media sources such as edge-attached cameras. This article explains how to use the media connector to perform tasks such as sending an image snapshot to the MQTT broker or saving a video stream to a local file system.
16+
17+
The media connector:
18+
19+
- Uses _asset endpoints_ to access media sources. An asset endpoint defines a connection to a media source such as a camera. The asset endpoint configuration includes the URL of the media source, the type of media source, and any credentials needed to access the media source.
20+
21+
- Uses _assets_ to represent media sources such as cameras. An asset defines the capabilities and properties of a media source such as a camera.
22+
23+
## Prerequisites
24+
25+
A deployed instance of Azure IoT Operations. If you don't already have an instance, see [Quickstart: Run Azure IoT Operations Preview in GitHub Codespaces with K3s](../get-started-end-to-end-sample/quickstart-deploy.md).
26+
27+
## Deploy the media server
28+
29+
If you're using the media connector to stream live video, you need to install your own media server. To deploy a sample media server to use with the media connector, run the following command:
30+
31+
```console
32+
kubectl create namespace media-server --dry-run=client -o yaml | kubectl apply -f - & kubectl apply -f https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/refs/heads/main/samples/media-connector-invoke-test/media-server/media-server-deployment.yaml --validate=false & kubectl apply -f https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/refs/heads/main/samples/media-connector-invoke-test/media-server/media-server-service.yaml --validate=false & kubectl apply -f https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/refs/heads/main/samples/media-connector-invoke-test/media-server/media-server-service-public.yaml --validate=false
33+
```
34+
35+
## Use Bicep to configure the media connector (preview)
36+
37+
You can use Bicep to define the asset endpoint and asset for a media source such as a camera. The following Bicep code shows how to define an asset endpoint and asset for a media source. The asset endpoint uses the anonymous authentication method to connect to the video stream:
38+
39+
```bicep
40+
metadata description = 'Asset endpoint profile and asset for a media source'
41+
param resourceName string
42+
param targetAddress string
43+
param customLocationName string
44+
param assetName string
45+
param strDescription string
46+
param bolEnabled bool
47+
param datasetsName string
48+
param datasetsDataPoints array
49+
50+
/*****************************************************************************/
51+
/* Existing AIO cluster */
52+
/*****************************************************************************/
53+
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
54+
name: customLocationName
55+
}
56+
/*****************************************************************************/
57+
/* Asset endpoint profile */
58+
/*****************************************************************************/
59+
resource assetEndpoint 'Microsoft.DeviceRegistry/assetEndpointProfiles@2024-11-01' = {
60+
name: resourceName
61+
location: resourceGroup().location
62+
extendedLocation: {
63+
type: 'CustomLocation'
64+
name: customLocation.id
65+
}
66+
properties: {
67+
targetAddress: targetAddress
68+
endpointProfileType: 'Media'
69+
authentication: {
70+
method: 'Anonymous'
71+
}
72+
}
73+
}
74+
/*****************************************************************************/
75+
/* Asset */
76+
/*****************************************************************************/
77+
resource asset 'Microsoft.DeviceRegistry/assets@2024-11-01' = {
78+
name: assetName
79+
location: resourceGroup().location
80+
extendedLocation: {
81+
type: 'CustomLocation'
82+
name: customLocation.id
83+
}
84+
properties: {
85+
displayName: assetName
86+
assetEndpointProfileRef: assetEndpoint.name
87+
description: strDescription
88+
enabled: bolEnabled
89+
datasets: [
90+
{
91+
name: datasetsName
92+
dataPoints: datasetsDataPoints
93+
}
94+
]
95+
}
96+
}
97+
```
98+
99+
The following JSON snippet shows a set of parameter values to use:
100+
101+
```json
102+
{
103+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
104+
"contentVersion": "1.0.0.0",
105+
"parameters": {
106+
"resourceName": {
107+
"value": "aep-public-http-anonymous-1"
108+
},
109+
"assetName": {
110+
"value": "asset-public-http-anonymous-1-snapshot-to-mqtt-autostart"
111+
},
112+
"strDescription": {
113+
"value": "snapshot to mqtt (autostart)"
114+
},
115+
"bolEnabled": {
116+
"value": true
117+
},
118+
"targetAddress": {
119+
"value": "https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/refs/heads/main/samples/shared-multimedia/IntroducingAzureIoTOperations.mp4"
120+
},
121+
"datasetsName": {
122+
"value": "snapshot-to-mqtt-autostart"
123+
},
124+
"datasetsDataPoints": {
125+
"value": [
126+
{
127+
"name": "snapshot-to-mqtt",
128+
"dataSource": "snapshot-to-mqtt",
129+
"dataPointConfiguration": "{\"taskType\":\"snapshot-to-mqtt\",\"autostart\":true,\"realtime\":true,\"loop\":true,\"format\":\"jpeg\",\"fps\":1}"
130+
}
131+
]
132+
}
133+
}
134+
}
135+
```
136+
137+
These parameters configure:
138+
139+
- The asset endpoint to connect to a video stream at `https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/refs/heads/main/samples/shared-multimedia/IntroducingAzureIoTOperations.mp4`.
140+
- The asset to capture snapshots from the video stream and publish them to an MQTT topic.
141+
142+
The default MQTT topic name that the connector publishes to is `<connector namespace>/data/<asset name>`.
143+
144+
To apply the previous configuration, save the previous examples as files, and run the following command:
145+
146+
```azurecli
147+
az deployment group create --resource-group <your resource group> --template-file aep-camera-anonymous.bicep --parameters snapshot-to-mqtt-autostart.json --parameters customLocationName=<your custom location>
148+
```
149+
150+
[!INCLUDE [discover-custom-location](../includes/discover-custom-location.md)]
151+
152+
This asset configuration publishes snapshots from the video stream to an MQTT topic. To view the snapshots, you can subscribe to the MQTT topic. To learn more about how to subscribe to an MQTT topic in a nonproduction environment, see [Test connectivity to MQTT broker with MQTT clients](../manage-mqtt-broker/howto-test-connection.md).
153+
154+
## Dataset configuration
155+
156+
The `datasetsDataPoints` parameter specifies the action the media connector takes on the asset. The previous example configures the camera to capture snapshots to publish to an MQTT broker topic. A camera asset supports the following five task types:
157+
158+
| Task type | Description |
159+
|-----------|-------------|
160+
| `snapshot-to-mqtt` | Capture snapshots from a camera and publishes them to an MQTT topic. |
161+
| `snapshot-to-fs` | Capture snapshots from a camera and saves them to the local file system. |
162+
| `clip-to-mqtt` | Capture video clips from a camera and publishes them to an MQTT topic. |
163+
| `clip-to-fs` | Capture video clips from a camera and saves them to the local file system. |
164+
| `stream-to-rtsp` | Sends a live video stream from a camera to a media server. |
165+
166+
You can use the following settings to configure individual tasks:
167+
168+
- `autostart`: Whether the task starts automatically when the asset starts.
169+
- `realtime`: Whether the task runs in real time.
170+
- `loop`: Whether the task runs continuously.
171+
- `format`: The format of the media file.
172+
- `fps`: The frames per second for the media file.
173+
- `audioEnabled`: Whether audio is enabled for the media file.
174+
- `duration`: The duration of the media file.
175+
176+
The following YAML snippets show example dataset configurations for each task type. The `taskType` value determines the task type to configure:
177+
178+
```yaml
179+
datasets:
180+
- name: dataset1
181+
dataPoints:
182+
- name: snapshot-to-mqtt
183+
dataSource: snapshot-to-mqtt
184+
dataPointConfiguration: |-
185+
{
186+
"taskType": "snapshot-to-mqtt",
187+
"autostart": true,
188+
"realtime": true,
189+
"loop": true,
190+
"format": "jpeg",
191+
"fps": 1
192+
}
193+
```
194+
195+
```yaml
196+
datasets:
197+
- name: dataset1
198+
dataPoints:
199+
- name: snapshot-to-fs
200+
dataSource: snapshot-to-fs
201+
dataPointConfiguration: |-
202+
{
203+
"taskType": "snapshot-to-fs",
204+
"autostart": false,
205+
"realtime": true,
206+
"loop": true,
207+
"format": "jpeg",
208+
"fps": 1
209+
}
210+
```
211+
212+
213+
```yaml
214+
datasets:
215+
- name: dataset1
216+
dataPoints:
217+
- name: clip-to-mqtt
218+
dataSource: clip-to-mqtt
219+
dataPointConfiguration: |-
220+
{
221+
"taskType": "clip-to-mqtt",
222+
"format": "avi",
223+
"autostart": true,
224+
"realtime": true,
225+
"loop": true,
226+
"fps": 3,
227+
"audioEnabled": false,
228+
"duration": 3
229+
}
230+
```
231+
232+
```yaml
233+
datasets:
234+
- name: dataset1
235+
dataPoints:
236+
- name: clip-to-fs
237+
dataSource: clip-to-fs
238+
dataPointConfiguration: |-
239+
{
240+
"taskType": "clip-to-fs",
241+
"format": "avi",
242+
"autostart": true,
243+
"realtime": true,
244+
"loop": true,
245+
"duration": 3
246+
}
247+
```
248+
249+
```yaml
250+
datasets:
251+
- name: dataset1
252+
dataPoints:
253+
- name: stream-to-rtsp
254+
dataSource: stream-to-rtsp
255+
dataPointConfiguration: |-
256+
{
257+
"taskType": "stream-to-rtsp",
258+
"autostart": true,
259+
"realtime": true,
260+
"loop": true
261+
}
262+
```
263+
264+
## Samples
265+
266+
For more examples that show how to configure and use the media connector, see the [Azure IoT Operations samples repository](https://github.com/Azure-Samples/explore-iot-operations/blob/main/samples/media-connector-invoke-test/README.md).

0 commit comments

Comments
 (0)