Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 90c8caa

Browse files
authored
Merge pull request #95 from robinsh/robinsh-1217-msgen-template
template for message enrichments and hub
2 parents 5d97d5b + 03fcbbb commit 90c8caa

File tree

1 file changed

+270
-0
lines changed

1 file changed

+270
-0
lines changed
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"randomValue": {
6+
"defaultValue": "[substring(uniqueString(utcNow()),0,8)]",
7+
"type": "string",
8+
"metadata": {
9+
"description": "Random alphanumeric string to make the assets have a unique name."
10+
}
11+
},
12+
"subscriptionId": {
13+
"type": "string",
14+
"defaultValue": "[subscription().subscriptionid]",
15+
"metadata": {
16+
"description": "The subscription ID of the Azure subscription to deploy into."
17+
}
18+
},
19+
"IoTHubName_in": {
20+
"type": "string",
21+
"defaultValue": "ContosoTestHubMsgEn",
22+
"metadata": {
23+
"description": "The name of the IoT Hub to create."
24+
}
25+
},
26+
"location": {
27+
"type": "string",
28+
"defaultValue": "westus2",
29+
"metadata": {
30+
"description": "The datacenter to use for the deployment."
31+
}
32+
},
33+
"sku_name": {
34+
"type": "string",
35+
"defaultValue": "S1",
36+
"metadata": {
37+
"description": "The SKU to use for the IoT Hub."
38+
}
39+
},
40+
"sku_units": {
41+
"type": "string",
42+
"defaultValue": "1",
43+
"metadata": {
44+
"description": "The number of IoT Hub units."
45+
}
46+
},
47+
"d2c_partitions": {
48+
"type": "string",
49+
"defaultValue": "4",
50+
"metadata": {
51+
"description": "Partitions used for the event stream."
52+
}
53+
},
54+
"storageAccountName_in": {
55+
"type": "string",
56+
"defaultValue": "contosostorage",
57+
"metadata": {
58+
"description": "Name of storage account to be created."
59+
}
60+
},
61+
"containerName1": {
62+
"type": "string",
63+
"defaultValue": "original",
64+
"metadata": {
65+
"description": "Name of the container in which to place the routed data."
66+
}
67+
},
68+
"containerName2": {
69+
"type": "string",
70+
"defaultValue": "enriched",
71+
"metadata": {
72+
"description": "Name of the container in which to place the routed data."
73+
}
74+
},
75+
"routeName1": {
76+
"type": "string",
77+
"defaultValue": "ContosoStorageRouteOriginal",
78+
"metadata": {
79+
"description": "Name of the endpoint for the storage account."
80+
}
81+
},
82+
"routeName2": {
83+
"type": "string",
84+
"defaultValue": "ContosoStorageRouteEnriched",
85+
"metadata": {
86+
"description": "Name of the endpoint for the storage account."
87+
}
88+
},
89+
"endpointName1": {
90+
"type": "string",
91+
"defaultValue": "ContosoStorageEndpointOriginal",
92+
"metadata": {
93+
"description": "Name of the endpoint for the storage account."
94+
}
95+
},
96+
"endpointName2": {
97+
"type": "string",
98+
"defaultValue": "ContosoStorageEndpointEnriched",
99+
"metadata": {
100+
"description": "Name of the endpoint for the storage account."
101+
}
102+
}
103+
},
104+
"variables": {
105+
"iotHubName": "[concat(parameters('IotHubName_in'),parameters('randomValue'))]",
106+
"storageAccountName": "[concat(parameters('storageAccountName_in'),parameters('randomValue'))]"
107+
},
108+
"resources": [
109+
{
110+
"type": "Microsoft.Storage/storageAccounts",
111+
"name": "[variables('storageAccountName')]",
112+
"apiVersion": "2018-07-01",
113+
"location": "[parameters('location')]",
114+
"sku": {
115+
"name": "Standard_LRS",
116+
"tier": "Standard"
117+
},
118+
"kind": "Storage",
119+
"properties": {},
120+
"resources": [
121+
{
122+
"type": "blobServices/containers",
123+
"apiVersion": "2018-07-01",
124+
"name": "[concat('default/', parameters('containerName1'))]",
125+
"properties": {
126+
"publicAccess": "None"
127+
} ,
128+
"dependsOn": [
129+
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
130+
]
131+
},
132+
{
133+
"type": "blobServices/containers",
134+
"apiVersion": "2018-07-01",
135+
"name": "[concat('default/', parameters('containerName2'))]",
136+
"properties": {
137+
"publicAccess": "None"
138+
} ,
139+
"dependsOn": [
140+
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
141+
]
142+
}
143+
]
144+
},
145+
{
146+
"apiVersion": "2019-11-04",
147+
"type": "Microsoft.Devices/IotHubs",
148+
"name": "[variables('IoTHubName')]",
149+
"location": "[parameters('location')]",
150+
"dependsOn": [
151+
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
152+
],
153+
"properties": {
154+
"eventHubEndpoints": {
155+
"events": {
156+
"retentionTimeInDays": 1,
157+
"partitionCount": "[parameters('d2c_partitions')]"
158+
}
159+
},
160+
"routing": {
161+
"enrichments": [
162+
{
163+
"key": "myIoTHub",
164+
"value": "$iothubname",
165+
"endpointNames": ["ContosoStorageEndpointEnriched"]
166+
},
167+
{
168+
"key": "DeviceLocation",
169+
"value": "$twin.tags.location",
170+
"endpointNames": ["ContosoStorageEndpointEnriched"]
171+
},
172+
{
173+
"key": "customerID",
174+
"value": "6ce345b8-1e4a-411e-9398-d34587459a3a",
175+
"endpointNames": ["ContosoStorageEndpointEnriched"]
176+
}
177+
],
178+
"endpoints": {
179+
"serviceBusQueues": [],
180+
"serviceBusTopics": [],
181+
"eventHubs": [],
182+
"storageContainers": [
183+
{
184+
"connectionString":
185+
"[Concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]",
186+
"containerName": "[parameters('containerName1')]",
187+
"fileNameFormat": "{iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}",
188+
"batchFrequencyInSeconds": 100,
189+
"maxChunkSizeInBytes": 104857600,
190+
"encoding": "json",
191+
"name": "[parameters('endpointName1')]",
192+
"subscriptionId": "[parameters('subscriptionId')]",
193+
"resourceGroup": "[resourceGroup().Name]"
194+
},
195+
{
196+
"connectionString":
197+
"[Concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]",
198+
"containerName": "[parameters('containerName2')]",
199+
"fileNameFormat": "{iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}",
200+
"batchFrequencyInSeconds": 100,
201+
"maxChunkSizeInBytes": 104857600,
202+
"encoding": "json",
203+
"name": "[parameters('endpointName2')]",
204+
"subscriptionId": "[parameters('subscriptionId')]",
205+
"resourceGroup": "[resourceGroup().Name]"
206+
}
207+
]
208+
},
209+
"routes": [
210+
{
211+
"name": "[parameters('routeName1')]",
212+
"source": "DeviceMessages",
213+
"condition": "level=\"storage\"",
214+
"endpointNames": [
215+
"[parameters('endpointName1')]"
216+
],
217+
"isEnabled": true
218+
},
219+
{
220+
"name": "[parameters('routeName2')]",
221+
"source": "DeviceMessages",
222+
"condition": "level=\"storage\"",
223+
"endpointNames": [
224+
"[parameters('endpointName2')]"
225+
],
226+
"isEnabled": true
227+
}
228+
],
229+
"fallbackRoute": {
230+
"name": "$fallback",
231+
"source": "DeviceMessages",
232+
"condition": "true",
233+
"endpointNames": [
234+
"events"
235+
],
236+
"isEnabled": true
237+
}
238+
},
239+
"storageEndpoints": {
240+
"$default": {
241+
"sasTtlAsIso8601": "PT1H",
242+
"connectionString": "",
243+
"containerName": ""
244+
}
245+
},
246+
"messagingEndpoints": {
247+
"fileNotifications": {
248+
"lockDurationAsIso8601": "PT1M",
249+
"ttlAsIso8601": "PT1H",
250+
"maxDeliveryCount": 10
251+
}
252+
},
253+
"enableFileUploadNotifications": false,
254+
"cloudToDevice": {
255+
"maxDeliveryCount": 10,
256+
"defaultTtlAsIso8601": "PT1H",
257+
"feedback": {
258+
"lockDurationAsIso8601": "PT1M",
259+
"ttlAsIso8601": "PT1H",
260+
"maxDeliveryCount": 10
261+
}
262+
}
263+
},
264+
"sku": {
265+
"name": "[parameters('sku_name')]",
266+
"capacity": "[parameters('sku_units')]"
267+
}
268+
}
269+
]
270+
}

0 commit comments

Comments
 (0)