CCF) (Codeless Connector Framework 提供合作夥伴、進階使用者及開發者,能夠創建自訂連接器以匯入資料給Microsoft Sentinel。
使用 CCF 建立的連接器為完全 SaaS,無需服務安裝。 同時也包含健康監控及 Microsoft Sentinel 的完整支援。
請依照以下步驟建立您的 CCF 連接器,並將資料來源連接到 Microsoft Sentinel
- 建立資料連接器
- 建立 ARM 範本
- 展開連接器
- 將 Microsoft Sentinel 連接到你的資料來源,開始擷取資料
本文將教你如何完成每個步驟,並提供一個範例的 無碼連接器 供你一路製作。
如果您是軟體開發夥伴,需要支援建立 CCF 資料連接器,請聯繫 Microsoft Sentinel PartnersAzureSentinelPartner@microsoft.com,尋求協助。
這個CCF和之前的版本有什麼不同?
CCF的初始版本於2022年1月 宣布 。 從那時起,我們對平台進行了改進,舊 版版本 不再被推薦。 這個新版本的CCF有以下主要改進:
對各種認證與分頁類型的支援更佳。
支援標準資料收集規則 (DCR) 。
無碼連接器的使用者介面與連接配置部分現已分開。 這使得能夠產生多重連接的連接器,這是過去無法實現的。
必要條件
在建立連接器之前,先了解你的資料來源,以及 Microsoft Sentinel 需要如何連結。
DCE) 資料收集端點 (
DCE 是 DCR 的要求。 每個日誌分析工作空間的 DCR 部署只會建立一個 DCE。 每個部署給 Microsoft Sentinel 工作空間的 DCR 都使用相同的 DCE。 關於如何建立端點或是否需要新的,請參閱 Azure Monitor 中的資料收集端點。
輸出表的結構 (s) 。
了解資料流的形狀以及你想在輸出表中包含的欄位非常重要。 參考你的資料來源文件或分析足夠的輸出範例。
請研究以下元件,並在 資料連接器 API 參考中確認其支援:
HTTP 請求與回應結構對資料來源
資料來源要求認證。
例如,如果你的資料來源需要用憑證簽署的憑證,資料連接器 API 參考中會明確表示不支援憑證認證。資料來源的分頁選項
測試 API
我們建議使用以下API測試工具來測試你的元件:
- Visual Studio Code 搭配 Visual Studio Marketplace 的擴充功能
- PowerShell Invoke-RestMethod
- Microsoft Edge - 網路主控台工具
- 布魯諾
- 捲曲
注意
對於擁有敏感資料的情況,例如憑證、秘密、存取權杖、API 金鑰及其他類似資訊,務必使用具備必要安全功能、離線或本地運作、不同步資料到雲端,且不需登入線上帳號的工具。 這樣一來,你就能降低暴露敏感資料給公眾的風險。
建立資料連接器
提示
如果您是獨立軟體供應商 (獨立軟體供應商) ,並在使用 Microsoft Sentinel 無碼連接器框架建構 Microsoft Sentinel 整合時需要支援,Microsoft App Assure 團隊或許能協助您。 若要與 App Assure 團隊互動,請寄電子郵件至 azuresentinelpartner@microsoft.com。
建造 CCF 資料連接器需要四個組件。
每個元件都有一節詳細說明建立與驗證的流程。 從每個元件取得 JSON 作為 ARM 模板的最終封裝。
輸出表定義
提示
如果你的資料只被匯入標準的 Log Analytics 資料表,可以跳過這個步驟。 標準資料表的例子包括 CommonSecurityLog 和 ASimDnsActivityLogs。 欲了解更多支援標準資料型態的完整清單,請參閱 自訂資料連接器的資料轉換支援。
如果你的資料來源不符合標準資料表的結構,你有兩個選擇:
- 為所有資料建立自訂表格
- 為部分資料建立自訂資料表,並將符合標準的資料拆分成標準資料表
使用 Log Analytics 介面,這是建立自訂表格與 DCR 的簡單方法。 如果你使用 Tables API 或其他程式化方法建立自訂資料表,請手動在資料表名稱後加上 _CL 後綴。 欲了解更多資訊,請參閱 建立自訂資料表。
想了解更多如何將資料拆分到多個資料表的資訊,請參閱範例 資料 以及為該資料建立的 自訂範例資料表 。
資料收集規則
DCR (資料收集規則) 定義Azure Monitor中的資料收集流程。 DCR 規定應收集哪些資料、如何轉換資料,以及資料傳送至何處。
- 每個資料連接器只會部署一個 DCR。
- DCR必須在同一區域內有對應的DCE。
- 當 CCF 資料連接器部署時,若尚未存在的 DCR,則會被建立。
請參閱以下文章中關於DCR的最新資訊:
如需示範如何建立 DCE,包括使用範例資料建立自訂資料表與 DCR,請參見教學:使用 Logs 導入 API 將資料傳送至 Azure 監控日誌 (Azure 入口網站) 。 請使用這個教學中的流程,用你的 DCR 確認資料是否正確地被匯入到你的資料表。
要了解如何建立具有多重資料流的複雜 DCR,請參閱 DCR 範例章節。
資料連接器使用者介面
此元件渲染 Microsoft Sentinel 資料連接器圖庫中資料連接器的使用者介面。 每個資料連接器只能有一個 UI 定義。
請使用 資料連接器定義 API 建置資料連接器使用者介面。 請參考 資料連接器定義 參考,作為補充說明,更詳細地解釋 API 元素。
附註:
-
kindAPI 輪詢連接器的屬性應該永遠是Customizable。 - 由於這是一種 API 輪詢連接器,請將類型設
connectivityCriteria為hasDataConnectors - 範例
instructionSteps包含一個類型的ConnectionToggleButton按鈕。 此按鈕可根據指定的連接參數觸發資料連接器規則的部署。
使用 API 測試工具 呼叫資料連接器定義 API,建立資料連接器的使用者介面,以便在資料連接器圖庫中驗證。
想從範例中學習,請參閱 資料連接器定義參考範例章節。
資料連接規則
目前有三種資料連接規則可用來定義你的 CCF 資料連接器。
-
RestApiPollerKIND 允許你自訂資料來源的分頁、授權及預期請求/回應有效載荷。 欲了解更多資訊,請參閱 RestApiPoller 資料連接器連線規則參考資料。 -
GCPkind 讓你能透過自動設定 Google Cloud Platform (GCP) 資料來源的分頁與預期回應有效載荷,來縮短開發時間。 欲了解更多資訊,請參閱 GCP 資料連接器連接規則參考 -
StorageAccountBlobContainerkind 允許你從 Azure Storage Blob 的資料來源擷取資料。 欲了解更多資訊,請參閱 Azure Storage Blob connectors API 參考資料。
使用 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."
}
},
// more deployment template information
}
}
使用 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 資料連接器範例
展開連接器
將你的無程式碼連接器部署為自訂範本。
提示
刪除你在前幾個步驟中建立的資源。 DCR 與自訂資料表會隨部署建立。 如果你在部署前不移除這些資源,驗證範本會變得更困難。
- 複製 ARM 部署範本的內容。
- 請依照文章《快速入門:使用 Azure 入口網站建立並部署 ARM 範本》中的編輯並部署範本指示。
維持日誌來源的網路隔離
如果你的日誌來源需要網路隔離,請設定 CCF 使用的公共 IP 允許清單。
Azure 虛擬網路使用服務標籤來定義網路存取控制。 對CCF來說,這個服務標籤是 潛水。
要查詢與 Scuba 服務標籤相關的當前 IP 範圍,請參閱 「使用服務標籤發現 API」。
驗證無碼連接器
請在資料連接器圖庫中查看您的無碼連接器。 打開資料連接器,完成所有連接所需的驗證參數。 成功連接後,DCR 與自訂資料表會被建立。 查看資源群組中的 DCR 資源,以及日誌分析工作區中的任何自訂資料表。
注意事項
可能需要長達30分鐘才能看到資料開始被接收。
範例
建構無碼連接器的每個步驟都在以下範例章節中呈現。
為了展示一個包含多個資料表的複雜資料來源,本範例包含輸出表結構及具有多重輸出串流的 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 資料連接器所需的四個 JSON 元件區段:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [],
}
用像 Visual Code 這類支援 JSON 的編輯器把這些區段串起來,盡量減少語法錯誤,例如逗號、括號和括號。
為了引導範本建立過程,註解會顯示在 元資料description 中或與 // 註解符號內嵌。 欲了解更多資訊,請參閱 ARM 範本最佳實務 - 評論。
可以考慮使用 ARM 模板測試工具包 (arm-ttk) 來驗證你所建立的範本。 欲了解更多資訊,請參閱 arm-ttk。
ARM 範本範例 - 參數
欲了解更多資訊,請參閱 ARM 範本中的參數。
警告
用於 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 - 欲了解更多資訊,請參閱 資料連線規則。
- 內容套件
"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')]"
}
}
// that's the end!
]
}
相關內容
如需詳細資訊,請參閱