-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainTemplate.json
More file actions
266 lines (265 loc) · 16.6 KB
/
mainTemplate.json
File metadata and controls
266 lines (265 loc) · 16.6 KB
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
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"workspace": {
"type": "string",
"metadata": {
"description": "The resource ID of the Log Analytics workspace."
}
}
},
"variables": {
"workspaceResourceId": "[resourceId('microsoft.OperationalInsights/Workspaces', parameters('workspace'))]",
"_connectorName": "RawEventIngestionSentinel",
"dataCollectionEndpointName": "[concat(variables('_connectorName'), '-DCE')]",
"tableName": "[concat(variables('_connectorName'), '_CL')]",
"dataCollectionRuleName": "[concat(variables('_connectorName'), '-DCR')]",
"dataCollectionDefinition": "[concat(variables('_connectorName'), 'Definition')]"
},
"resources": [
{
"type": "Microsoft.Insights/dataCollectionEndpoints",
"apiVersion": "2023-03-11",
"name": "[variables('dataCollectionEndpointName')]",
"location": "eastus",
"properties": {
"configurationAccess": {},
"logsIngestion": {},
"metricsIngestion": {},
"networkAcls": {
"publicNetworkAccess": "Enabled"
}
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/tables",
"apiVersion": "2023-09-01",
"name": "[concat(parameters('workspace'), '/', variables('tableName'))]",
"location": "[parameters('location')]",
"properties": {
"schema": {
"name": "[variables('tableName')]",
"columns": [
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "Source",
"type": "string"
},
{
"name": "SourceIp",
"type": "string"
},
{
"name": "Event",
"type": "dynamic"
}
]
}
}
},
{
"type": "Microsoft.Insights/dataCollectionRules",
"apiVersion": "2023-03-11",
"name": "[variables('dataCollectionRuleName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Insights/dataCollectionEndpoints', variables('dataCollectionEndpointName'))]",
"[concat(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), '/tables/', variables('tableName'))]"
],
"properties": {
"dataCollectionEndpointId": "[resourceId('Microsoft.Insights/dataCollectionEndpoints', variables('dataCollectionEndpointName'))]",
"streamDeclarations": {
"Custom-RawEventIngestionSentinel": {
"columns": [
{
"name": "Source",
"type": "string"
},
{
"name": "SourceIp",
"type": "string"
},
{
"name": "Event",
"type": "dynamic"
}
]
}
},
"destinations": {
"logAnalytics": [
{
"workspaceResourceId": "[variables('workspaceResourceId')]",
"name": "clv2ws1"
}
]
},
"dataFlows": [
{
"streams": [ "Custom-RawEventIngestionSentinel" ],
"destinations": [ "clv2ws1" ],
"transformKql": "source | extend TimeGenerated = now()",
"outputStream": "[concat('Custom-', variables('tableName'))]"
}
]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/dataConnectorDefinitions",
"apiVersion": "2022-09-01-preview",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',variables('dataCollectionDefinition'))]",
"location": "[parameters('location')]",
"kind": "Customizable",
"properties": {
"connectorUiConfig": {
"id": "[variables('dataCollectionDefinition')]",
"title": "Raw Event Ingestion for Microsoft Sentinel",
"publisher": "Microsoft",
"descriptionMarkdown": "This connector allows you to push any type of raw events to Microsoft Sentinel and ingest them to your workspace. This connector utilises the Log Ingestion API. [See the documentation to learn more about the Log Ingestion API](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-ingestion-api-overview).",
"graphQueriesTableName": "[variables('tableName')]",
"graphQueries": [
{
"metricName": "Total events received",
"legend": "Raw Event Ingestion Sentinel",
"baseQuery": "{{graphQueriesTableName}}"
}
],
"sampleQueries": [
{
"description": "Get Sample of logs",
"query": "{{graphQueriesTableName}}\n | take 10"
}
],
"dataTypes": [
{
"name": "{{graphQueriesTableName}}",
"lastDataReceivedQuery": "{{graphQueriesTableName}}\n| where TimeGenerated > ago(12h)\n| summarize Time = max(TimeGenerated)\n| where isnotempty(Time)"
}
],
"connectivityCriteria": [
{
"type": "IsConnectedQuery",
"value": [
"RawEventIngestionSentinel_CL\n| summarize LastLogReceived = max(TimeGenerated)\n| project IsConnected = LastLogReceived > ago(1d)"
]
}
],
"availability": {
"status": 1,
"isPreview": false
},
"permissions": {
"resourceProvider": [
{
"provider": "Microsoft.OperationalInsights/workspaces",
"permissionsDisplayText": "Read and Write permissions are required.",
"providerDisplayName": "Workspace",
"scope": "Workspace",
"requiredPermissions": {
"read": true,
"write": true,
"delete": true,
"action": false
}
},
{
"provider": "Microsoft.OperationalInsights/workspaces/sharedKeys",
"permissionsDisplayText": "Read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key)",
"providerDisplayName": "Keys",
"scope": "Workspace",
"requiredPermissions": {
"read": false,
"write": false,
"delete": false,
"action": true
}
}
],
"customs": [
{
"name": "Microsoft.Web/sites permissions",
"description": "Read and write permissions to Azure Functions to create a Function App is required. [See the documentation to learn more about Azure Functions](https://docs.microsoft.com/azure/azure-functions/)."
},
{
"name": "Log Forwarder API Permissions",
"description": "Make sure to have enough permissions to forward logs from your service to an endpoint."
}
]
},
"instructionSteps": [
{
"title": "",
"description": "**Raw Event Ingestion Sentinel**\n\n>**NOTE:** This connector uses Azure Functions to connect to any service with log forwarder enables to push logs into Microsoft Sentinel. This might result in additional data ingestion costs. Check the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/) for details.\n>**(Optional Step)** Securely store workspace and API authorization key(s) or token(s) in Azure Key Vault. Azure Key Vault provides a secure mechanism to store and retrieve key values. [Follow these instructions](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) to use Azure Key Vault with an Azure Function App.\n\n**Step 1 - Enable Log Forwarder**\nMake sure that log forwarder or similar service is enabled in your workspace. This is essential to push logs into Microsoft Sentinel."
},
{
"title": "",
"description": "**STEP 2 - Choose ONE from the following two deployment options to deploy the connector and the associated Azure Function**\n\n>**IMPORTANT:** Before deploying the data connector, have the Workspace ID and Workspace Primary Key (can be copied from the following), as well as Azure Blob Storage connection string and container name, readily available.",
"instructions": [
{
"parameters": {
"fillWith": [ "WorkspaceId" ],
"label": "Workspace ID"
},
"type": "CopyableLabel"
},
{
"parameters": {
"fillWith": [ "PrimaryKey" ],
"label": "Primary Key"
},
"type": "CopyableLabel"
},
{
"parameters": {
"fillWith": [ "https://<logpush-ingestion-endpoint>/data" ],
"label": "Log Forwarder Endpoint"
},
"type": "CopyableLabel"
},
{
"type": "ConnectionToggleButton",
"parameters": {
"connectLabel": "Connect",
"disconnectLabel": "Disconnect",
"name": "connectionToggle"
}
}
]
},
{
"title": "",
"description": "**STEP 3 - Configuring Log Forwarder**\n\nAfter deploying the Azure Function App configure your log forwarder service to push logs to the above endpoint."
},
{
"title": "Option 1 - Azure Resource Manager (ARM) Template",
"description": "Use this method for automated deployment of the data connector using an ARM Template.\n\n1. Click the **Deploy to Azure** button below. \n\n\t[](https://github.com/Tintintani/Sentinel-any-Event-Collector)\n2. Select the preferred **Subscription**, **Resource Group** and **Location**.\n3. Enter the **Microsoft Sentinel Workspace Id**, **Microsoft Sentinel Shared Key**\n4. Mark the checkbox labeled **I agree to the terms and conditions stated above**.\n5. Click **Purchase** to deploy."
},
{
"title": "Option 2 - Manual Deployment of Azure Functions",
"description": "Use the following step-by-step instructions to deploy the data connector manually with Azure Functions (Deployment via Visual Studio Code)."
},
{
"title": "",
"description": "**1. Deploy a Function App**\n\n> **NOTE:** You will need to [prepare VS code](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-python) for Azure function development.\n\n1. Download the [Azure Function App](https://aka.ms/sentinel-GCPDNSDataConnector-functionapp) file. Extract archive to your local development computer.\n2. Start VS Code. Choose File in the main menu and select Open Folder.\n3. Select the top level folder from extracted files.\n4. Choose the Azure icon in the Activity bar, then in the **Azure: Functions** area, choose the **Deploy to function app** button.\nIf you aren't already signed in, choose the Azure icon in the Activity bar, then in the **Azure: Functions** area, choose **Sign in to Azure**\nIf you're already signed in, go to the next step.\n5. Provide the following information at the prompts:\n\n\ta. **Select folder:** Choose a folder from your workspace or browse to one that contains your function app.\n\n\tb. **Select Subscription:** Choose the subscription to use.\n\n\tc. Select **Create new Function App in Azure** (Don't choose the Advanced option)\n\n\td. **Enter a globally unique name for the function app:** Type a name that is valid in a URL path. The name you type is validated to make sure that it's unique in Azure Functions.\n\n\te. **Select a runtime:** Choose Python 3.11.\n\n\tf. Select a location for new resources. For better performance and lower costs choose the same [region](https://azure.microsoft.com/regions/) where Microsoft Sentinel is located.\n\n6. Deployment will begin. A notification is displayed after your function app is created and the deployment package is applied.\n7. Go to Azure Portal for the Function App configuration."
},
{
"title": "",
"description": "**2. Configure the Function App**\n\n1. In the Function App, select the Function App Name and select **Configuration**.\n2. In the **Application settings** tab, select **+ New application setting**.\n3. Add each of the following application settings individually, with their respective string values (case-sensitive): \n\t\tRESOURCE_NAMES\n\t\tCREDENTIALS_FILE_CONTENT\n\t\tWORKSPACE_ID\n\t\tSHARED_KEY\n\t\tlogAnalyticsUri (Optional)\n - Use logAnalyticsUri to override the log analytics API endpoint for dedicated cloud. For example, for public cloud, leave the value empty; for Azure GovUS cloud environment, specify the value in the following format: `https://WORKSPACE_ID.ods.opinsights.azure.us`. \n4. Once all application settings have been entered, click **Save**."
}
]
}
}
}
]
}