-
Notifications
You must be signed in to change notification settings - Fork 16k
/
azuredeploy.json
278 lines (278 loc) · 11.4 KB
/
azuredeploy.json
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"eventHubNewOrExisting": {
"type": "string",
"defaultValue": "new",
"metadata": {
"description": "Determines whether or not a new Event Hub is provisioned."
}
},
"eventHubResourceGroup": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "If you have an existing Event Hub provide the Resource Group name here."
}
},
"eventHubNamespaceName": {
"type": "string",
"defaultValue": "tsiquickstartns",
"metadata": {
"description": "The namespace of the source event hub."
}
},
"eventHubName": {
"type": "string",
"defaultValue": "tsiquickstarteh",
"metadata": {
"description": "The name of the source event hub."
}
},
"consumerGroupName": {
"type": "string",
"defaultValue": "tsiquickstart",
"metadata": {
"description": "The name of the consumer group that the Time Series Insights service will use to read the data from the event hub. NOTE: To avoid resource contention, this consumer group must be dedicated to the Time Series Insights service and not shared with other readers."
}
},
"environmentName": {
"type": "string",
"maxLength": 90,
"defaultValue": "tsiquickstart",
"metadata": {
"description": "Name of the environment. The name cannot include: '<', '>', '%', '&', ':', '\\', '?', '/' and any control characters. All other characters are allowed."
}
},
"environmentDisplayName": {
"type": "string",
"defaultValue": "tsiquickstart",
"maxLength": 90,
"metadata": {
"description": "An optional friendly name to show in tooling or user interfaces instead of the environment name."
}
},
"environmentSkuName": {
"type": "string",
"defaultValue": "S1",
"allowedValues": ["S1", "S2"],
"metadata": {
"description": "The name of the sku. For more information, see https://azure.microsoft.com/pricing/details/time-series-insights/"
}
},
"environmentSkuCapacity": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"maxValue": 10,
"metadata": {
"description": "The unit capacity of the Sku. For more information, see https://azure.microsoft.com/pricing/details/time-series-insights/"
}
},
"environmentDataRetentionTime": {
"type": "string",
"defaultValue": "P30D",
"metadata": {
"description": "The minimum timespan the environment’s events will be available for query. The value must be specified in the ISO 8601 format, e.g. \"P30D\" for a retention policy of 30 days."
}
},
"eventSourceName": {
"type": "string",
"defaultValue": "tsiquickstart",
"maxLength": 90,
"metadata": {
"description": "Name of the event source child resource. The name cannot include: '<', '>', '%', '&', ':', '\\', '?', '/' and any control characters. All other characters are allowed."
}
},
"eventSourceDisplayName": {
"type": "string",
"defaultValue": "tsiquickstart",
"maxLength": 90,
"metadata": {
"description": "An optional friendly name to show in tooling or user interfaces instead of the event source name."
}
},
"eventSourceTimestampPropertyName": {
"type": "string",
"defaultValue": "",
"maxLength": 90,
"metadata": {
"description": "The event property that will be used as the event source's timestamp. If a value isn't specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used."
}
},
"eventSourceKeyName": {
"type": "string",
"defaultValue": "manage",
"metadata": {
"description": "The name of the shared access key that the Time Series Insights service will use to connect to the event hub."
}
},
"accessPolicyReaderObjectIds": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "A list of object ids of the users or applications in AAD that should have Reader access to the environment. The service principal objectId can be obtained by calling the Get-AzureRMADUser or the Get-AzureRMADServicePrincipal cmdlets. Creating an access policy for AAD groups is not yet supported."
}
},
"accessPolicyContributorObjectIds": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "A list of object ids of the users or applications in AAD that should have Contributor access to the environment. The service principal objectId can be obtained by calling the Get-AzureRMADUser or the Get-AzureRMADServicePrincipal cmdlets. Creating an access policy for AAD groups is not yet supported."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"environmentTagsOptions": [
null,
{
"displayName": "[parameters('environmentDisplayName')]"
}
],
"environmentTagsValue": "[variables('environmentTagsOptions')[length(take(parameters('environmentDisplayName'), 1))]]",
"eventSourceTagsOptions": [
null,
{
"displayName": "[parameters('eventSourceDisplayName')]"
}
],
"eventSourceTagsValue": "[variables('eventSourceTagsOptions')[length(take(parameters('eventSourceDisplayName'), 1))]]",
"eventSourceResourceId": "[resourceId(parameters('eventHubResourceGroup'), 'Microsoft.EventHub/Namespaces/EventHubs', parameters('eventHubNamespaceName'), parameters('eventHubName'))]"
},
"resources": [
{
"condition": "[equals(parameters('eventHubNewOrExisting'), 'new')]",
"apiVersion": "2021-01-01-preview",
"name": "[parameters('eventHubNamespaceName')]",
"type": "Microsoft.EventHub/namespaces",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"properties": {
"isAutoInflateEnabled": true,
"maximumThroughputUnits": 20
},
"resources": [
{
"condition": "[equals(parameters('eventHubNewOrExisting'), 'new')]",
"apiVersion": "2017-04-01",
"name": "[parameters('eventHubName')]",
"type": "eventhubs",
"dependsOn": ["[parameters('eventHubNamespaceName')]"],
"properties": {
"messageRetentionInDays": 7,
"partitionCount": 4
},
"resources": [
{
"condition": "[equals(parameters('eventHubNewOrExisting'), 'new')]",
"type": "authorizationRules",
"name": "[parameters('eventSourceKeyName')]",
"apiVersion": "2017-04-01",
"location": "[parameters('location')]",
"dependsOn": ["[parameters('eventHubName')]"],
"properties": {
"rights": ["Listen", "Send", "Manage"]
}
},
{
"condition": "[equals(parameters('eventHubNewOrExisting'), 'new')]",
"apiVersion": "2017-04-01",
"name": "[parameters('consumerGroupName')]",
"type": "consumergroups",
"dependsOn": ["[parameters('eventHubName')]"]
}
]
}
]
},
{
"type": "Microsoft.TimeSeriesInsights/environments",
"name": "[parameters('environmentName')]",
"apiVersion": "2017-11-15",
"location": "[parameters('location')]",
"properties": {
"dataRetentionTime": "[parameters('environmentDataRetentionTime')]"
},
"sku": {
"name": "[parameters('environmentSkuName')]",
"capacity": "[parameters('environmentSkuCapacity')]"
},
"tags": "[variables('environmentTagsValue')]",
"resources": [
{
"type": "eventsources",
"name": "[parameters('eventSourceName')]",
"apiVersion": "2017-11-15",
"location": "[parameters('location')]",
"kind": "Microsoft.EventHub",
"dependsOn": [
"[resourceId('Microsoft.TimeSeriesInsights/environments/', parameters('environmentName'))]",
"[resourceId('Microsoft.EventHub/Namespaces', parameters('eventHubNamespaceName'))]",
"[resourceId('Microsoft.EventHub/Namespaces/EventHubs/ConsumerGroups', parameters('eventHubNamespaceName'), parameters('eventHubName'), parameters('consumerGroupName'))]",
"[resourceId('Microsoft.EventHub/Namespaces/EventHubs/AuthorizationRules', parameters('eventHubNamespaceName'), parameters('eventHubName'), parameters('eventSourceKeyName'))]"
],
"properties": {
"eventSourceResourceId": "[variables('eventSourceResourceId')]",
"eventHubName": "[parameters('eventHubName')]",
"serviceBusNamespace": "[parameters('eventHubNamespaceName')]",
"consumerGroupName": "[parameters('consumerGroupName')]",
"keyName": "[parameters('eventSourceKeyName')]",
"sharedAccessKey": "[listkeys(resourceId(parameters('eventHubResourceGroup'), 'Microsoft.EventHub/Namespaces/EventHubs/AuthorizationRules', parameters('eventHubNamespaceName'), parameters('eventHubName'), parameters('eventSourceKeyName')), '2021-01-01-preview').primaryKey]",
"timestampPropertyName": "[parameters('eventSourceTimestampPropertyName')]"
},
"tags": "[variables('eventSourceTagsValue')]"
}
]
},
{
"condition": "[not(empty(parameters('accessPolicyReaderObjectIds')))]",
"type": "Microsoft.TimeSeriesInsights/environments/accessPolicies",
"name": "[concat(parameters('environmentName'), '/', 'readerAccessPolicy', copyIndex())]",
"copy": {
"name": "accessPolicyReaderCopy",
"count": "[if(empty(parameters('accessPolicyReaderObjectIds')), 1, length(parameters('accessPolicyReaderObjectIds')))]"
},
"apiVersion": "2017-11-15",
"dependsOn": [
"[resourceId('Microsoft.TimeSeriesInsights/environments/', parameters('environmentName'))]"
],
"properties": {
"principalObjectId": "[parameters('accessPolicyReaderObjectIds')[copyIndex()]]",
"roles": ["Reader"]
}
},
{
"condition": "[not(empty(parameters('accessPolicyContributorObjectIds')))]",
"type": "Microsoft.TimeSeriesInsights/environments/accessPolicies",
"name": "[concat(parameters('environmentName'), '/', 'contributorAccessPolicy', copyIndex())]",
"copy": {
"name": "accessPolicyContributorCopy",
"count": "[if(empty(parameters('accessPolicyContributorObjectIds')), 1, length(parameters('accessPolicyContributorObjectIds')))]"
},
"apiVersion": "2017-11-15",
"dependsOn": [
"[resourceId('Microsoft.TimeSeriesInsights/environments/', parameters('environmentName'))]"
],
"properties": {
"principalObjectId": "[parameters('accessPolicyContributorObjectIds')[copyIndex()]]",
"roles": ["Contributor"]
}
}
],
"outputs": {
"dataAccessFQDN": {
"value": "[reference(resourceId('Microsoft.TimeSeriesInsights/environments', parameters('environmentName'))).dataAccessFQDN]",
"type": "string"
}
}
}