Skip to content
This repository was archived by the owner on Jun 29, 2019. It is now read-only.

Commit 88df523

Browse files
committed
Revert "Revert "Testing "Deploy to Azure" button from Github. (Preview)""
This reverts commit 2aa00ee.
1 parent 2aa00ee commit 88df523

2 files changed

Lines changed: 173 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Streaming Analysis Architectural Pattern
2+
3+
This architectural pattern allows you to receive streaming data from an event hub, pass it to stream analytics which in turn calls an Azure ML web service. The deploy button below allows
4+
you to deploy the needed Azure resources in your Azure subscription.
5+
6+
[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/)
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"nameprefix": {
6+
"type": "string",
7+
"metadata": {
8+
"description": "Prefix for solution name"
9+
}
10+
}
11+
},
12+
13+
"variables": {
14+
"storageAccountType": "Standard_LRS",
15+
"location": "[resourceGroup().location]",
16+
"storageVersion": "[providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]]",
17+
"storageName": "[toLower(concat(parameters('nameprefix'), 'store'))]",
18+
"storageId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageName'))]",
19+
"sbVersion": "[providers('Microsoft.Eventhub', 'namespaces').apiVersions[0]]",
20+
"sbName": "[concat(parameters('nameprefix'), '-servicebus')]",
21+
"ehInName": "[concat(parameters('nameprefix'), '-ehin')]",
22+
"sbKeyName": "RootManageSharedAccessKey",
23+
"sbResourceId": "[resourceId('Microsoft.Eventhub/namespaces/authorizationRules', variables('sbName'), variables('sbKeyName'))]",
24+
"saJobName": "[concat(parameters('nameprefix'), '-sajob')]",
25+
"saVersion": "2015-06-01"
26+
},
27+
28+
"resources": [
29+
{
30+
"apiVersion": "[variables('storageVersion')]",
31+
"type": "Microsoft.Storage/storageAccounts",
32+
"name": "[variables('storageName')]",
33+
"location": "[variables('location')]",
34+
"properties": { "accountType": "[variables('storageAccountType')]" }
35+
},
36+
{
37+
"apiVersion": "[variables('sbVersion')]",
38+
"name": "[variables('sbName')]",
39+
"type": "Microsoft.Eventhub/namespaces",
40+
"location": "[variables('location')]",
41+
"properties": {
42+
"region": "[variables('location')]"
43+
},
44+
"resources": [
45+
{
46+
"apiVersion": "[variables('sbVersion')]",
47+
"name": "[variables('ehInName')]",
48+
"type": "eventHubs",
49+
"location": "[variables('location')]",
50+
"dependsOn": [
51+
"[concat('Microsoft.Eventhub/namespaces/', variables('sbName'))]"
52+
],
53+
"properties": {
54+
"path": "[variables('ehInName')]"
55+
}
56+
}
57+
]
58+
},
59+
{
60+
"apiVersion": "[variables('saVersion')]",
61+
"type": "Microsoft.StreamAnalytics/streamingjobs",
62+
"name": "[variables('saJobName')]",
63+
"location": "[variables('location')]",
64+
"dependsOn": [
65+
"[concat('Microsoft.Storage/storageAccounts/', variables('storageName'))]"
66+
],
67+
"properties": {
68+
"sku": { "name": "standard" },
69+
"EventsOutOfOrderMaxDelayInSeconds": 10,
70+
"EventsOutOfOrderPolicy": "adjust",
71+
"Inputs": [
72+
{
73+
"Name": "IoTHubStream",
74+
"Properties": {
75+
"DataSource": {
76+
"Properties": {
77+
"ConsumerGroupName": "",
78+
"EventHubName": "[variables('ehInName')]",
79+
"ServiceBusNamespace": "[variables('sbName')]",
80+
"SharedAccessPolicyKey": "[listkeys(variables('sbResourceId'), variables('sbVersion')).primaryKey]",
81+
"SharedAccessPolicyName": "[variables('sbKeyName')]"
82+
},
83+
"Type": "Microsoft.ServiceBus/EventHub"
84+
},
85+
"Serialization": {
86+
"Properties": {
87+
"Encoding": "UTF8"
88+
},
89+
"Type": "Json"
90+
},
91+
"Type": "Stream"
92+
}
93+
}
94+
],
95+
"Outputs": [
96+
{
97+
"Name": "StreamOutput",
98+
"Properties": {
99+
"DataSource": {
100+
"Properties": {
101+
"Container": "devicetelemetry",
102+
"DateFormat": "yyyy/MM/dd",
103+
"TimeFormat": "HH",
104+
"PathPattern": "Output/logs/{date}/{time}",
105+
"StorageAccounts": [
106+
{
107+
"AccountKey": "[listkeys(variables('storageId'), variables('storageVersion')).key1]",
108+
"AccountName": "[variables('storageName')]"
109+
}
110+
]
111+
},
112+
"Type": "Microsoft.Storage/Blob"
113+
},
114+
"Serialization": {
115+
"Properties": {
116+
"Encoding": "UTF8",
117+
"Format": "Array"
118+
},
119+
"Type": "Json"
120+
}
121+
}
122+
},
123+
{
124+
"Name": "SummaryOutput",
125+
"Properties": {
126+
"DataSource": {
127+
"Properties": {
128+
"Container": "DeviceTelemetrySummary",
129+
"DateFormat": "yyyy/MM/dd",
130+
"TimeFormat": "HH",
131+
"PathPattern": "Output/logs/{date}/{time}",
132+
"StorageAccounts": [
133+
{
134+
"AccountKey": "[listkeys(variables('storageId'), variables('storageVersion')).key1]",
135+
"AccountName": "[variables('storageName')]"
136+
}
137+
]
138+
},
139+
"Type": "Microsoft.Storage/Blob"
140+
},
141+
"Serialization": {
142+
"Properties": {
143+
"Encoding": "UTF8",
144+
"Format": "Array"
145+
},
146+
"Type": "Json"
147+
}
148+
}
149+
}
150+
],
151+
"Transformation": {
152+
"Name": "AllToBlob",
153+
"Properties": {
154+
"Query": "WITH [StreamData] AS (SELECT * FROM [IoTHubStream] TIMESTAMP BY Time) SELECT * INTO [StreamOutput] FROM [StreamData] SELECT AVG(Humidity) AS [AverageHumidity], MIN(Humidity) AS [MinimumHumidity], MAX(Humidity) AS [MaxHumidity], 5.0 AS TimeframeMinutes INTO [SummaryOutput] FROM [StreamData] WHERE [Humidity] IS NOT NULL GROUP BY SlidingWindow (mi, 5)",
155+
"StreamingUnits": 1
156+
}
157+
}
158+
}
159+
}
160+
],
161+
"outputs": {
162+
"ehInPath": { "type": "string", "value": "[variables('ehInName')" },
163+
"sbConnectionString": { "type": "string", "value": "[listkeys(variables('sbResourceId'), variables('sbVersion')).primaryConnectionString]" },
164+
"storageName": { "type": "string", "value": "[variables('storageName')]" },
165+
"storagekey": { "type": "string", "value": "[listkeys(variables('storageId'), variables('storageVersion')).key1]" }
166+
}
167+
}

0 commit comments

Comments
 (0)