無程式代碼連接器架構 (CCF) 可讓合作夥伴、進階使用者和開發人員建立自定義連接器,以擷取數據至 sentinel Microsoft。
連接器可分為拉取/輪詢式連接器或推送式連接器,具體取決於資料來源及建置者的偏好。 本文著重於提取連接器,這類連接器採用輪詢方式,會定期透過 API 擷取資料。 關於推送連接器的資訊,請參見「為 Microsoft Sentinel 建立推送無碼連接器」。
使用 CCF 建立的連接器是完全 SaaS,不需要服務安裝。 同時也包含健康監控及 Microsoft Sentinel 的完整支援。
請使用以下步驟建立您的 CCF 連接器,並將資料來源連接到 Microsoft Sentinel:
- 建立資料連接器
- 建立 ARM 範本
- 展開連接器
- 將 Microsoft Sentinel 連接到你的資料來源,開始擷取資料
每個步驟都包含一個範例無 碼連接器 供你一路製作。
如果您是軟體開發合作夥伴,需要支援來建立 CCF 資料連接器,請聯絡 Microsoft Sentinel Partners AzureSentinelPartner@microsoft.com 尋求協助。
相較於先前 CCF 版本的改進
CCF 的初始版本於 2022 年 1 月在 Microsoft Tech Community 部落格上公布。 此後平台已有所改進,舊 版版本 不再被推薦。 這個新版的 CCF 具有下列重要改進:
對各種認證與分頁類型的支援更佳。
支援標準資料收集規則 (DCR) 。
無碼連接器的使用者介面與連接配置部分現已分開。 這使得能夠產生多重連接的連接器,這是過去無法實現的。
Prerequisites
在建立連接器之前,先了解你的資料來源,以及 Microsoft Sentinel 需要如何連結。
資料收集端點 (DCE)
DCE 是 DCR 的必要條件。 每個 Log Analytics 工作區的 DCR 部署只會建立一個 DCE。 每個部署給 Microsoft Sentinel 工作空間的 DCR 都使用相同的 DCE。 關於如何建立端點或是否需要新的,請參閱 Azure 監視器 中的資料收集端點。
輸出資料表的結構。
了解資料流的形狀以及你想在輸出表中包含的欄位非常重要。 參考你的資料來源文件或分析足夠的輸出範例。
請研究以下元件,並在 資料連接器 API 參考中確認其支援:
傳送至資料來源的 HTTP 請求與回應結構
資料來源要求認證。
例如,如果您的資料來源需要以憑證簽署的權杖,資料連接器 API 參考會指出不支援憑證驗證。資料來源的分頁選項
測試 API
使用以下API測試工具測試您的元件:
- 使用 Visual Studio Code 搭配來自 Visual Studio Marketplace 的 Microsoft Sentinel 擴充功能。 該擴充套件支援實作與測試巢狀 API 輪詢工作流程。 關於設置與使用資訊,請參閱「在 Microsoft Sentinel 中用 AI 建立自訂連接器」。
- PowerShell Invoke-RestMethod
- Microsoft Edge 網路控制台工具
- 布魯諾
- curl
注意事項
對於使用敏感資料的情況,例如憑證、秘密、存取權杖或 API 金鑰,請使用能保護你資料的工具。 選擇一個離線或本地都能使用、不會同步資料到雲端,也不需要登入線上帳號的工具。 這些防護措施降低了敏感資料外洩的風險。
建立資料連接器
Tip
如果您是獨立軟體廠商 (ISV) ,而且使用 Microsoft Sentinel 無程式碼連接器架構建置 Microsoft Sentinel 整合時需要支援,Microsoft App Assure 小組或許可以提供協助。 若要與 App Assure 團隊互動,請傳送電子郵件至 azuresentinelpartner@microsoft.com。
建置CCF資料連接器需要四個元件。
每個元件都有一節詳細說明建立與驗證的流程。 從每個元件擷取 JSON,用於 ARM 範本的最終封裝。
輸出表定義
Tip
如果你的資料只被匯入標準的 Log Analytics 資料表,可以跳過這個步驟。 標準資料表的例子包括 CommonSecurityLog 和 ASimDnsActivityLogs。 欲了解更多支援標準資料型態的完整清單,請參閱 自訂資料連接器的資料轉換支援。
如果你的資料來源不符合標準資料表的結構,你有兩個選擇:
- 為所有資料建立自訂表格
- 為部分資料建立自訂資料表,並將符合標準的資料拆分成標準資料表
使用 Log Analytics 介面,這是建立自訂表格與 DCR 的簡單方法。 如果你使用 Tables API 或其他程式化方法建立自訂資料表,請手動在資料表名稱後加上 _CL 後綴。 欲了解更多資訊,請參閱 建立自訂資料表。
想了解更多如何將資料拆分到多個資料表的資訊,請參閱範例 資料 以及為該資料建立的 自訂範例資料表 。
資料收集規則
DCR (資料收集規則) 定義Azure 監視器中的資料收集流程。 DCR 規定應收集哪些資料、如何轉換資料,以及資料傳送至何處。
- 每個資料連接器只會部署一個 DCR。
- DCR 必須在相同的區域中有對應的 DCE。
- 部署 CCF 資料連接器時,如果 DCR 尚未存在,則會建立 DCR。
請參閱以下文章中關於DCR的最新資訊:
如需示範如何建立 DCE,包括使用範例資料建立自訂資料表與 DCR,請參見教學:使用 Logs 導入 API 將資料傳送至 Azure 監控日誌 (Azure 入口網站) 。 請使用這個教學中的流程,用你的 DCR 確認資料是否正確地被匯入到你的資料表。
要了解如何建立具有多重資料流的複雜 DCR,請參閱 DCR 範例章節。
資料連接器使用者介面
此元件渲染 Microsoft Sentinel 資料連接器圖庫中資料連接器的使用者介面。 每個資料連接器只能有一個 UI 定義。
請使用 資料連接器定義 API 建置資料連接器使用者介面。 請參考 資料連接器定義 參考,作為補充說明,更詳細地解釋 API 元素。
注意:
- API 輪詢連接器的
kind屬性應一律為Customizable。 - 由於這是一種 API 輪詢連接器,請將 型別設
connectivityCriteria為hasDataConnectors。 - 範例
instructionSteps包含一個類型的ConnectionToggleButton按鈕。 此按鈕可根據指定的連接參數觸發資料連接器規則的部署。
使用 API 測試工具 呼叫資料連接器定義 API,建立資料連接器的使用者介面,並在資料連接器圖庫中驗證。
想從範例中學習,請參閱 資料連接器定義參考範例章節。
資料連線規則
目前有三種資料連接規則可用來定義你的 CCF 資料連接器。
-
RestApiPollerkind 允許你自訂資料來源的分頁、授權設定,以及預期的請求與回應承載內容。 你也可以使用目前處於公開預覽階段的巢狀 API 輪詢,在同一輪詢週期內串連相依的 API 請求。 關於標準連線規則的屬性,請參見 RestApiPoller 資料連接器連線規則參考。 要設定相依請求,請參考 「使用巢狀 API 輪詢建立無程式碼拉取資料連接器」。 -
GCPkind 讓你能透過自動設定 Google Cloud Platform (GCP) 資料來源的分頁與預期回應有效載荷,來縮短開發時間。 欲了解更多資訊,請參閱 GCP 資料連接器連接規則參考。 -
StorageAccountBlobContainerkind 允許你從 Azure 儲存體 Blob 的資料來源擷取資料。 欲了解更多資訊,請參閱 Azure 儲存體 Blob 連接器 API 參考及 Azure 儲存體 Blob 連接器範例。
使用 API 測試工具 呼叫資料連接器 API,建立結合連線規則與先前元件的資料連接器。 在介面上確認接頭是否已連接。
安全機密輸入
無論您的CCF資料連接器使用何種驗證,請採取下列步驟以確保機密資訊保持安全。 目標是將認證從 ARM 範本傳遞至 CCF,而不會在部署歷程記錄中留下可讀取的機密物件。
在連接器介面中建立憑證標籤
資料連接器定義會建立一個 UI 元素,用來提示安全憑證。 舉例來說,如果你的資料連接器用 OAuth 認證日誌來源,資料連接器定義區塊會在指令中包含該 OAuthForm 類型。 這會設定 ARM 範本,使其提示輸入認證資訊。
"instructions": [
{
"type": "OAuthForm",
"parameters": {
"UsernameLabel": "Username",
"PasswordLabel": "Password",
"connectButtonLabel": "Connect",
"disconnectButtonLabel": "Disconnect"
}
}
],
儲存機密輸入
ARM 部署範本的一個區段提供管理員在部署資料連接器時輸入密碼的位置。 用 securestring 來將機密資訊保存在部署後無法讀取的物件中。 欲了解更多資訊,請參閱 安全性建議中的參數。
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "[variables('dataConnectorCCPVersion')]",
"parameters": {
"Username": {
"type": "securestring",
"minLength": 1,
"metadata": {
"description": "Enter the username to connect to your data source."
},
"Password": {
"type": "securestring",
"minLength": 1,
"metadata": {
"description": "Enter the API key, client secret or password required to connect."
}
},
}
}
使用 securestring 物件
最後,CCF 在資料連接器區段使用憑證物件。
"auth": {
"type": "OAuth2",
"ClientSecret": "[[parameters('Password')]",
"ClientId": "[[parameters('Username')]",
"GrantType": "client_credentials",
"TokenEndpoint": "https://api.contoso.com/oauth/token",
"TokenEndpointHeaders": {
"Content-Type": "application/x-www-form-urlencoded"
},
"TokenEndpointQueryParameters": {
"grant_type": "client_credentials"
}
}
備註
憑證物件的奇怪語法 `"ClientSecret": "[[parameters('Password')]",` 並不是筆誤。
若要建立也會使用參數的部署範本,請在該區段的參數開頭多加一個起始 [ 以逸出參數。 這讓參數能根據使用者與連接器的互動來指派一個值。
如需詳細資訊,請參閱範本運算式逸出字元。
建立部署範本
手動打包一個Azure資源管理 (ARM) 範本,並參考範例範本程式碼範例作為指引。 這些程式碼範例依 ARM 範本區段分割,必須將它們拼接在一起。
如果您要建立Google Cloud Platform (GCP) CCF 資料連接器,請使用 範例 GCP CCF 範本封裝部署範本。 如需如何填寫 GCP CCF 範本的資訊,請參閱 GCP 資料連接器連線規則參考。
除了範例範本之外,Microsoft Sentinel 內容中樞中提供的已發佈解決方案也會使用 CCF 作為其數據連接器。 請參考以下解法,作為如何將元件拼接成 ARM 範本的更多範例。
RestApiPoller CCF 數據連接器範例
GCP CCF 數據連接器範例
展開連接器
將你的無程式碼連接器部署為自訂範本。
Tip
刪除你在前幾個步驟中建立的資源。 DCR 與自訂資料表會隨部署建立。 如果你在部署前不移除這些資源,驗證範本會變得更困難。
保持記錄來源的網路隔離
如果您的記錄來源需要網路隔離,請設定CCF所使用的公用IP位址允許清單。
Azure 虛擬網路使用服務標籤來定義網路存取控制。 對於CCF,該服務標籤是 Scuba。
要查詢與 Scuba 服務標籤相關的當前 IP 範圍,請參閱 「使用服務標籤發現 API」。
驗證無碼連接器
請在資料連接器圖庫中查看您的無碼連接器。 打開資料連接器,完成所有連接所需的驗證參數。 成功連接後,DCR 與自訂資料表會被建立。 查看資源群組中的 DCR 資源,以及日誌分析工作區中的任何自訂資料表。
備註
資料開始擷取可能需要長達 30 分鐘的時間。
Example
建構無碼連接器的每個步驟都在以下範例章節中呈現。
為了展示一個包含多個資料表的複雜資料來源,本範例包含輸出表結構及具有多重輸出串流的 DCR。 DCR 範例將這些與其 KQL 轉換結合起來。 資料連接器的使用者介面定義與連線規則範例延續自同一範例資料來源。 最後,解決方案範本會使用這些範例元件來顯示端對端如何建立範例 CCF 數據連接器。
範例資料
資料來源在連接端點時回傳以下 JSON。
[
{
"ts": "3/6/2023 8:15:15 AM",
"eventType": "Alert",
"deviceMac": "bc:27:c6:21:1c:70",
"clientMac": "",
"srcIp": "10.12.11.106",
"destIp": "121.93.178.13",
"protocol": "tcp/ip",
"priority": "0",
"message": "This is an alert message"
},
{
"ts": "3/6/2023 8:14:54 AM",
"eventType": "File",
"srcIp": "178.175.128.249",
"destIp": "234.113.125.105",
"fileType": "MS_EXE",
"fileSizeBytes": 193688,
"disposition": "Malicious"
}
]
此回應包含 eventTypeAlert 與 File。 檔案事件將被導入標準化的表格 AsimFileEventLogs,而警報事件則會被匯入自訂資料表。
自訂表格範例
欲了解更多此表格結構的資訊,請參閱 表格 API。 自訂日誌表名稱應該加上 _CL 後綴。
{
"properties": {
"schema": {
"name": "ExampleConnectorAlerts_CL",
"columns": [
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "SourceIP",
"type": "string"
},
{
"name": "DestIP",
"type": "string"
},
{
"name": "Message",
"type": "string"
},
{
"name": "Priority",
"type": "int"
}
]
}
}
}
資料收集規則範例
以下 DCR 利用範例資料來源定義單一串流 Custom-ExampleConnectorInput ,並將輸出轉換成兩個資料表。
- 第一個資料流會
eventType= 引導 Alert 到自訂ExampleConnectorAlerts_CL資料表。 - 第二條資料流將
eventType= 檔案導向正規化標準表。ASimFileEventLogs
欲了解更多關於此範例結構的資訊,請參閱 資料收集規則的結構。
要在測試環境中建立此 DCR,請遵循 資料收集規則 API。 範例中的 {{double curly braces}} 元素表示需要取值以便於 API 測試工具使用的變數。 當你在 ARM 範本中建立此資源時,這裡表達的變數會被交換成參數。
{
"location": "{{location}}",
"properties": {
"dataCollectionEndpointId": "/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Insights/dataCollectionEndpoints/{{dataCollectionEndpointName}}",
"streamDeclarations": {
"Custom-ExampleConnectorInput": {
"columns": [
{
"name": "ts",
"type": "datetime"
},
{
"name": "eventType",
"type": "string"
},
{
"name": "deviceMac",
"type": "string"
},
{
"name": "clientMac",
"type": "string"
},
{
"name": "srcIp",
"type": "string"
},
{
"name": "destIp",
"type": "string"
},
{
"name": "protocol",
"type": "string"
},
{
"name": "priority",
"type": "string"
},
{
"name": "message",
"type": "string"
},
{
"name": "fileType",
"type": "string"
},
{
"name": "fileSizeBytes",
"type": "int"
},
{
"name": "disposition",
"type": "string"
}
]
}
},
"destinations": {
"logAnalytics": [
{
"workspaceResourceId": "/subscriptions/{{subscriptionId}}/resourcegroups/{{resourceGroupName}}/providers/microsoft.operationalinsights/workspaces/{{workspaceName}}",
"name": "{{uniqueFriendlyDestinationName}}"
}
]
},
"dataFlows": [
{
"streams": [
"Custom-ExampleConnectorInput"
],
"destinations": [
"{{uniqueFriendlyDestinationName}}"
],
"transformKql": "source | where eventType == \"Alert\" | project TimeGenerated = ts, SourceIP = srcIp, DestIP = destIp, Message = message, Priority = priority \n",
"outputStream": "Custom-ExampleConnectorAlerts_CL"
},
{
"streams": [
"Custom-ExampleConnectorInput"
],
"destinations": [
"{{uniqueFriendlyDestinationName}}"
],
"transformKql": "source | where eventType == \"File\" | project-rename TimeGenerated = ts, EventOriginalType = eventType, SrcIpAddr = srcIp, DstIpAddr = destIp, FileContentType = fileType, FileSize = fileSizeBytes, EventOriginalSeverity = disposition \n",
"outputStream": "Microsoft-ASimFileEventLogs"
}
]
}
}
資料連接器 UI 定義範例
此範例位於 資料連接器定義參考中。
資料連接器連接規則範例
此範例位於 資料連接器參考資料中。
ARM 範本範例
使用下列結構建置 ARM 部署範本,其中包含建置 CCF 資料連接器所需的 4 個 JSON 元件區段:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [],
}
請使用支援 JSON 的編輯器 (例如 Visual Studio Code) 縫合各區段,以減少逗號、右方括號及右括號等語法錯誤。
為了引導範本建立過程,註解會顯示在 元資料description 中或與 // 註解符號內嵌。 欲了解更多資訊,請參閱 ARM 範本最佳實務 - 評論。
可以考慮使用 ARM 模板測試工具包 (arm-ttk) 來驗證你所建立的範本。 欲了解更多資訊,請參閱 arm-ttk。
ARM 範本範例 - 參數
欲了解更多資訊,請參閱 ARM 範本中的參數。
Warning
對於在資源部署後可讀取的物件中的所有密碼和祕密資訊,請使用 securestring。
欲了解更多資訊,請參閱 「安全機密輸入 」及 「安全建議」以了解參數。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"minLength": 1,
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Not used, but needed to pass the arm-ttk test, 'Location-Should-Not-Be-Hardcoded'. Instead the `workspace-location` derived from the log analytics workspace is used."
}
},
"workspace-location": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "[concat('Region to deploy solution resources -- separate from location selection',parameters('location'))]"
}
},
"subscription": {
"defaultValue": "[last(split(subscription().id, '/'))]",
"type": "string",
"metadata": {
"description": "subscription id where Microsoft Sentinel is configured"
}
},
"resourceGroupName": {
"defaultValue": "[resourceGroup().name]",
"type": "string",
"metadata": {
"description": "resource group name where Microsoft Sentinel is configured"
}
},
"workspace": {
"defaultValue": "",
"type": "string",
"metadata": {
"description": "the log analytics workspace enabled for Microsoft Sentinel"
}
}
},
// Next is the variables section here
}
ARM 範本範例 - 變數
這些推薦的變數有助於簡化範本。 多用或少用,視需要而定。 欲了解更多資訊,請參閱 ARM 範本中的變數。
"variables": {
"workspaceResourceId": "[resourceId('microsoft.OperationalInsights/Workspaces', parameters('workspace'))]",
"_solutionName": "Solution name", // Enter your solution name
"_solutionVersion": "3.0.0", // must be 3.0.0 or above
"_solutionAuthor": "Contoso", // Enter the name of the author
"_packageIcon": "<img src=\"{LogoLink}\" width=\"75px\" height=\"75px\">", // Enter the http link for the logo. NOTE: This field is only recommended for Azure Global Cloud.
"_solutionId": "azuresentinel.azure-sentinel-solution-azuresentinel.azure-sentinel-MySolution", // Enter a name for your solution with this format but exchange the 'MySolution' portion
"dataConnectorVersionConnectorDefinition": "1.0.0",
"dataConnectorVersionConnections": "1.0.0",
"_solutionTier": "Community", // This designates the appropriate support - all custom data connectors are "Community"
"_dataConnectorContentIdConnectorDefinition": "MySolutionTemplateConnectorDefinition", // Enter a name for the connector
"dataConnectorTemplateNameConnectorDefinition": "[concat(parameters('workspace'),'-dc-',uniquestring(variables('_dataConnectorContentIdConnectorDefinition')))]",
"_dataConnectorContentIdConnections": "MySolutionTemplateConnections", // Enter a name for the connections this connector makes
"dataConnectorTemplateNameConnections": "[concat(parameters('workspace'),'-dc-',uniquestring(variables('_dataConnectorContentIdConnections')))]",
"_logAnalyticsTableId1": "ExampleConnectorAlerts_CL" // Enter the custom table name - not needed if you are ingesting data into standard tables
// Enter more variables as needed "":""
},
// Next is the resources sections here
ARM 範本範例 - 資源
此範本指南中有 5 個 ARM 部署資源,其中包含 4 個 CCF 數據連接器建置元件。
- 內容範本 (父資源)
- dataConnectorDefinitions - 欲了解更多資訊,請參閱 Data 連接器使用者介面。
- 中繼資料
-
內容範本
- 中繼資料
- RestApiPoller - 欲了解更多資訊,請參閱 資料連線規則。
- contentPackages
"resources": [
// resource section 1 - contentTemplates
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/', variables('dataConnectorTemplateNameConnectorDefinition'), variables('dataConnectorVersionConnectorDefinition'))]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
"contentId": "[variables('_dataConnectorContentIdConnectorDefinition')]",
"displayName": "[concat(variables('_solutionName'), variables('dataConnectorTemplateNameConnectorDefinition'))]",
"contentKind": "DataConnector",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "[variables('dataConnectorVersionConnectorDefinition')]",
"parameters": {},
"variables": {},
"resources": [
{
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('DataConnector-', variables('_dataConnectorContentIdConnectorDefinition')))]",
"apiVersion": "2022-01-01-preview",
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"properties": {
"parentId": "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/dataConnectorDefinitions', variables('_dataConnectorContentIdConnectorDefinition'))]",
"contentId": "[variables('_dataConnectorContentIdConnectorDefinition')]",
"kind": "DataConnector",
"version": "[variables('dataConnectorVersionConnectorDefinition')]",
"source": {
"sourceId": "[variables('_solutionId')]",
"name": "[variables('_solutionName')]",
"kind": "Solution"
},
"author": {
"name": "[variables('_solutionAuthor')]"
},
"support": {
"name": "[variables('_solutionAuthor')]",
"tier": "[variables('_solutionTier')]"
},
"dependencies": {
"criteria": [
{
"version": "[variables('dataConnectorVersionConnections')]",
"contentId": "[variables('_dataConnectorContentIdConnections')]",
"kind": "ResourcesDataConnector"
}
]
}
}
},
{
"name": "MyDCRV1", // Enter your DCR name
"apiVersion": "2021-09-01-preview",
"type": "Microsoft.Insights/dataCollectionRules",
"location": "[parameters('workspace-location')]",
"kind": null,
"properties":
{
// Enter your DCR properties here.
// Consider using these variables:
// "dataCollectionEndpointId": "[concat('/subscriptions/',parameters('subscription'),'/resourceGroups/',parameters('resourceGroupName'),'/providers/Microsoft.Insights/dataCollectionEndpoints/',parameters('workspace'))]",
// "workspaceResourceId": "[variables('workspaceResourceId')]",
}
},
{
"name": "[variables('_logAnalyticsTableId1')]",
"apiVersion": "2022-10-01",
"type": "Microsoft.OperationalInsights/workspaces/tables",
"location": "[parameters('workspace-location')]",
"kind": null,
"properties":
{
// Enter your log analytics table schema here.
// Consider using this variable for the name property:
// "name": "[variables('_logAnalyticsTableId1')]",
}
}
// Enter more tables if needed.
]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"contentProductId": "[concat(substring(variables('_solutionId'), 0, 50),'-','dc','-', uniqueString(concat(variables('_solutionId'),'-','DataConnector','-',variables('_dataConnectorContentIdConnectorDefinition'),'-', variables('dataConnectorVersionConnectorDefinition'))))]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
"version": "[variables('_solutionVersion')]"
}
},
// resource 2 section here
// resource section 2 - dataConnectorDefinitions
{
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',variables('_dataConnectorContentIdConnectorDefinition'))]",
"apiVersion": "2022-09-01-preview",
"type": "Microsoft.OperationalInsights/workspaces/providers/dataConnectorDefinitions",
"location": "[parameters('workspace-location')]",
"kind": "Customizable",
"properties":
{
//Enter your data connector definition properties here
//"connectorUiConfig": {
// "graphQueriesTableName": "[variables('_logAnalyticsTableId1')]",
//},
}
},
// resource 3 section here
// resource section 3 - metadata
{
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('DataConnector-', variables('_dataConnectorContentIdConnectorDefinition')))]",
"apiVersion": "2022-01-01-preview",
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"properties": {
"parentId": "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/dataConnectorDefinitions', variables('_dataConnectorContentIdConnectorDefinition'))]",
"contentId": "[variables('_dataConnectorContentIdConnectorDefinition')]",
"kind": "DataConnector",
"version": "[variables('dataConnectorVersionConnectorDefinition')]",
"source": {
"sourceId": "[variables('_solutionId')]",
"name": "[variables('_solutionName')]",
"kind": "Solution"
},
"author": {
"name": "[variables('_solutionAuthor')]"
},
"support": {
"name": "[variables('_solutionAuthor')]",
"tier": "[variables('_solutionTier')]"
},
"dependencies": {
"criteria": [
{
"version": "[variables('dataConnectorVersionConnections')]",
"contentId": "[variables('_dataConnectorContentIdConnections')]",
"kind": "ResourcesDataConnector"
}
]
}
}
},
// resource 4 section here
// resource section 4 - contentTemplates
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/', variables('dataConnectorTemplateNameConnections'), variables('dataConnectorVersionConnections'))]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
"contentId": "[variables('_dataConnectorContentIdConnections')]",
"displayName": "[concat(variables('_solutionName'), variables('dataConnectorTemplateNameConnections'))]",
"contentKind": "ResourcesDataConnector",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "[variables('dataConnectorVersionConnections')]",
"parameters":
// These parameters are used by the data connector primarily as properties for the administrator to enter in the UI when configuring the connector
{
"connectorDefinitionName": {
"defaultValue": "connectorDefinitionName",
"type": "string",
"minLength": 1
},
"workspace": {
"defaultValue": "[parameters('workspace')]",
"type": "string"
},
"dcrConfig": {
"defaultValue": {
"dataCollectionEndpoint": "data collection Endpoint",
"dataCollectionRuleImmutableId": "data collection rule immutableId"
},
"type": "object"
}
// Enter additional parameters, for example:
//"domainname": {
// "defaultValue": "domain name",
// "type": "string",
// "minLength": 1
//},
//"apikey": {
// "defaultValue": "",
// "type": "securestring",
// "minLength": 1
//}
},
"variables": {
"_dataConnectorContentIdConnections": "[variables('_dataConnectorContentIdConnections')]"
},
"resources": [
{
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('DataConnector-', variables('_dataConnectorContentIdConnections')))]",
"apiVersion": "2022-01-01-preview",
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"properties": {
"parentId": "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/dataConnectors', variables('_dataConnectorContentIdConnections'))]",
"contentId": "[variables('_dataConnectorContentIdConnections')]",
"kind": "ResourcesDataConnector",
"version": "[variables('dataConnectorVersionConnections')]",
"source": {
"sourceId": "[variables('_solutionId')]",
"name": "[variables('_solutionName')]",
"kind": "Solution"
},
"author": {
"name": "[variables('_solutionAuthor')]"
},
"support": {
"name": "[variables('_solutionAuthor')]",
"tier": "[variables('_solutionTier')]"
}
}
},
{
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/', 'MyDataConnector')]", // Replace the last part of the name with your data connector name
// To create several connections using this template, make the name dynamic. For example, use the 'concat' function to add the connector name with a GUID using the 'guid' function.
"apiVersion": "2022-12-01-preview",
"type": "Microsoft.OperationalInsights/workspaces/providers/dataConnectors",
"location": "[parameters('workspace-location')]",
"kind": "RestApiPoller",
"properties":
{
// Enter your data connector properties here. If you want to use UI parameters remember to escape the parameter like this: "[[parameters('paramName')]"
// Use parameters as needed. For example:
// "dataType": "My product security event API",
// "response": {
// "eventsJsonPaths": [
// "$"
// ],
// "format": "json"
// },
// "paging": {
// "pagingType": "LinkHeader"
// },
// "connectorDefinitionName": "[[parameters('connectorDefinitionName')]",
// "auth": {
// "apiKeyName": "Authorization",
// "ApiKey": "[[parameters('apikey')]",
// "apiKeyIdentifier": "SSWS",
// "type": "APIKey"
//} ,
// "request": {
// "apiEndpoint": "[[concat('https://',parameters('domainname'),'/api/v1/logs')]",
// "rateLimitQPS": 10,
// "queryWindowInMin": 5,
// "httpMethod": "GET",
// "retryCount": 3,
// "timeoutInSeconds": 60,
// "headers": {
// "Accept": "application/json",
// "User-Agent": "My-Data-Source"
// },
// "startTimeAttributeName": "since",
// "endTimeAttributeName": "until"
// },
// "dcrConfig": {
// "dataCollectionEndpoint": "[[parameters('dcrConfig').dataCollectionEndpoint]",
// "dataCollectionRuleImmutableId": "[[parameters('dcrConfig').dataCollectionRuleImmutableId]",
// "streamName": "Custom-ExampleConnectorAlerts_CL" //This input stream should be the same as the inputStream property configured for the DataCollectionRule
// },
// "isActive": true
}
}
]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"contentProductId": "[concat(substring(variables('_solutionId'), 0, 50),'-','rdc','-', uniqueString(concat(variables('_solutionId'),'-','ResourcesDataConnector','-',variables('_dataConnectorContentIdConnections'),'-', variables('dataConnectorVersionConnections'))))]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
"version": "[variables('_solutionVersion')]"
}
},
// resource 5 section here
// resource section 5 - contentPackages
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentPackages",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/', variables('_solutionId'))]",
"location": "[parameters('workspace-location')]",
"apiVersion": "2023-04-01-preview",
"properties": {
"version": "[variables('_solutionVersion')]",
"kind": "Solution",
"contentSchemaVersion": "3.0.0",
"contentId": "[variables('_solutionId')]",
"source": {
"kind": "Solution",
"name": "[variables('_solutionName')]",
"sourceId": "[variables('_solutionId')]"
},
"author": {
"name": "[variables('_solutionAuthor')]"
},
"support": {
"name": "[variables('_solutionAuthor')]"
},
"dependencies": {
"operator": "AND",
"criteria": [
{
"kind": "DataConnector",
"contentId": "[variables('dataConnectorVersionConnectorDefinition')]",
"version": "[variables('_dataConnectorContentIdConnectorDefinition')]"
}
]
},
"firstPublishDate": "2023-12-05",
"providers": [
"[variables('_solutionAuthor')]"
],
"contentKind": "Solution",
"packageId": "[variables('_solutionId')]",
"contentProductId": "[concat(substring(variables('_solutionId'), 0, 50),'-','sl','-', uniqueString(concat(variables('_solutionId'),'-','Solution','-',variables('_solutionId'),'-', variables('_solutionVersion'))))]",
"displayName": "[variables('_solutionName')]",
"publisherDisplayName": "[variables('_solutionId')]",
"descriptionHtml": "test",
"icon": "[variables('_packageIcon')]"
}
}
]
}