-
Notifications
You must be signed in to change notification settings - Fork 0
/
quickstart.bicep
74 lines (70 loc) · 2.27 KB
/
quickstart.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
param serviceCatalog bool = false
var iotHubName = 'iothub-${uniqueString(resourceGroup().id)}'
var iotHubServiceConnectionString = 'HostName=${iotHub.properties.hostName};SharedAccessKeyName=iothubowner;SharedAccessKey=${listKeys(iotHub.id, iotHub.apiVersion).value[0].primaryKey}'
var iotHubEventHubConnectionString = 'Endpoint=${iotHub.properties.eventHubEndpoints.events.endpoint};SharedAccessKeyName=iothubowner;SharedAccessKey=${listKeys(iotHub.id, iotHub.apiVersion).value[0].primaryKey};EntityPath=${iotHub.properties.eventHubEndpoints.events.path}'
var managedGroupId = '${resourceGroup().id}-resources-${uniqueString(resourceGroup().id)}'
var kind = serviceCatalog ? 'servicecatalog' : 'marketplace'
resource managedApp 'Microsoft.Solutions/applications@2021-07-01' = {
name: 'ux4iot'
kind: kind
location: resourceGroup().location
plan: serviceCatalog ? null : {
name: 'standard'
product: 'ux4iot'
publisher: 'deviceinsightgmbh-4961725'
version: '2.0.0'
}
properties: {
managedResourceGroupId: managedGroupId
applicationDefinitionId: serviceCatalog ? '/subscriptions/ab92703c-7fdb-4a1e-8ea8-b402f4e2ea25/resourceGroups/ux4iot-shared/providers/Microsoft.Solutions/applicationDefinitions/ux4iot' : null
parameters: {
iotHubEventHubConnectionString: {
value: iotHubEventHubConnectionString
}
iotHubServiceConnectionString: {
value: iotHubServiceConnectionString
}
}
}
}
resource iotHub 'Microsoft.Devices/IotHubs@2021-03-31' = {
name: iotHubName
location: resourceGroup().location
sku: {
capacity: 1
name: 'S1'
}
properties: {
routing: {
fallbackRoute: {
name: '$fallback'
source: 'DeviceMessages'
condition: 'true'
endpointNames: [
'events'
]
isEnabled: true
}
routes: [
{
name: 'ux4iot-twin-changes'
isEnabled: true
source: 'TwinChangeEvents'
condition: 'true'
endpointNames: [
'events'
]
}
{
name: 'ux4iot-connection-events'
isEnabled: true
source: 'DeviceConnectionStateEvents'
condition: 'true'
endpointNames: [
'events'
]
}
]
}
}
}