共用方式為


建立 Microsoft Sentinel 的無程式代碼連接器 (公開預覽)

無程式代碼 連線 or 平臺 (CCP) 提供合作夥伴、進階使用者,以及開發人員建立自定義連接器以將數據內嵌至 Microsoft Sentinel 的能力。

使用 CCP 建立的 連線 器是完全 SaaS,不需要服務安裝。 它們也包括 來自 Microsoft Sentinel 的健康情況監視 和完整支援。

重要

無程式代碼 連線 平臺 (CCP) 目前處於預覽狀態。 Azure 預覽補充條款 包含適用於 Azure 功能 (搶鮮版 (Beta)、預覽版,或尚未發行的版本) 的其他法律條款。

使用下列步驟來建立 CCP 連接器,並將數據源連線至 Microsoft Sentinel

  • 建置數據連接器
  • 建立 ARM 範本
  • 部署連接器
  • 連線 Microsoft Sentinel 至數據源並開始擷取數據

本文將說明如何完成每個步驟,並提供範例 無程式代碼連接器 ,以一路建置。

此 CCP 與舊版有什麼不同?

CCP 的最初版本於 2022 年 1 月公佈 。 從那時起,我們已改善平臺, 因此不再建議使用舊版版本 。 這個新版的 CCP 具有下列重要改進:

  1. 更妥善地支援各種驗證和分頁類型。

  2. 支援標準數據收集規則 (DCR)。

  3. 無程式代碼連接器的使用者介面和連線設定部分現在會分開。 這可讓您建立具有先前無法進行之多個連線的連接器。

必要條件

建置連接器之前,請先瞭解您的數據源,以及 Microsoft Sentinel 需要如何連線。

  1. 資料收集端點 (DCE)

    DCE 是 DCR 的需求。 每個 Log Analytics 工作區 DCR 部署只會建立一個 DCE。 針對 Microsoft Sentinel 工作區部署的每個 DCR 都會使用相同的 DCE。 如需如何建立一個或是否需要新的集合端點的詳細資訊,請參閱 Azure 監視器中的數據收集端點。

  2. 輸出數據表的架構。

    請務必了解數據流的形狀,以及您想要包含在輸出數據表中的欄位。 參考您的數據源檔,或分析足夠的輸出範例。

研究下列元件,並在數據 連線 or API 參考確認它們的支援:

  1. 數據源的 HTTP 要求和響應結構

  2. 數據源所需的驗證。
    例如,如果您的數據來源需要使用憑證簽署的令牌,則數據連接器 API 參考會指定不支持憑證驗證。

  3. 數據源的分頁選項

我們也建議您使用 Postman 之類的工具來驗證數據連接器元件。 如需詳細資訊,請參閱 搭配 Microsoft Graph API 使用 Postman。

建置數據連接器

建置 CCP 資料連接器需要 4 個元件。

  1. 輸出數據表定義
  2. 資料收集規則 (DCR)
  3. 數據連接器使用者介面
  4. 數據連接器連線規則

每個元件都有一個區段,詳細說明要建立和驗證的程式。 從每個元件取得 JSON,以取得 ARM 範本的最終封裝。

輸出數據表定義

提示

如果您的數據只內嵌至標準 Log Analytics 數據表,請略過此步驟。 標準數據表的範例包括 CommonSecurityLogASimDnsActivityLogs。 如需支援之標準數據類型完整清單的詳細資訊,請參閱 自定義數據連接器的數據轉換支援。

如果您的資料來源不符合標準資料表的架構,您有兩個選項:

  • 建立所有數據的自定義數據表
  • 為某些數據建立自定義數據表,並將符合規範的數據分割成標準數據表

使用 Log Analytics UI 進行直接方法,以搭配 DCR 建立自定義數據表。 如果您使用數據表 API 或其他程式設計方法建立自訂數據表,請手動將後綴新增_CL至數據表名稱。 如需詳細資訊,請參閱 建立自定義數據表

如需將數據分割成多個數據表的詳細資訊,請參閱針對該數據建立的範例數據和範例自定義數據表

資料收集規則

資料收集規則 (DCR) 會在 Azure 監視器中定義資料收集流程。 DCR 會指定應收集的資料、如何轉換該資料,以及傳送該資料的位置。

  • 每個數據連接器只會部署一個 DCR。
  • DCR 必須在相同的區域中有對應的 DCE。
  • 部署 CCP 數據連接器時,如果 DCR 尚未存在,則會建立 DCR。

請參閱下列文章中 DCR 的最新資訊:

如需示範如何建立 DCE 的教學課程,包括使用範例數據來建立自定義數據表和 DCR,請參閱教學課程:使用記錄擷取 API(Azure 入口網站)將數據傳送至 Azure 監視器記錄。 使用本教學課程中的程式,確認數據已正確內嵌到您的數據表與 DCR。

若要瞭解如何建立具有多個數據流的複雜 DCR,請參閱 DCR 範例一節

數據連接器使用者介面

此元件會在 Microsoft Sentinel 數據連接器資源庫中轉譯數據連接器的 UI。 每個數據連接器可能只有一個UI定義。

使用 Data 連線 or Definition API 建置數據連接器使用者介面。 使用數據連接器定義參考做為補充,更詳細地說明 API 元素。

注意:

  1. kind API 輪詢連接器的屬性應該一律為 Customizable
  2. 因為這是 API 輪詢連接器的類型,請將類型設定 connectivityCriteriahasDataConnectors
  3. 此範例 instructionsSteps 包含 類型的 ConnectionToggleButton按鈕。 此按鈕可協助根據指定的連接參數觸發數據連接器規則的部署。

使用 Postman 呼叫資料連接器定義 API 來建立資料連接器 UI,以便在數據連接器資源庫中進行驗證。

若要從範例中學習,請參閱 數據連接器定義參考範例一節

數據連線規則

此部份會定義連線規則,包括:

  • 投票
  • 驗證 (authentication)
  • 尋呼

如需建置本節的詳細資訊,請參閱 數據連接器連線規則參考

若要從範例中學習,請參閱 數據連接器連接規則參考範例

使用 Postman 呼叫數據連接器 API 來建立結合連接規則和先前元件的數據連接器。 確認連接器現在已在UI中連線。

保護機密輸入

無論您的 CCP 資料連接器使用何種驗證,請採取下列步驟,以確保機密資訊保持安全。 目標是將認證從 ARM 範本傳遞至 CCP,而不會在部署歷程記錄中留下可讀取的機密物件。

建立標籤

數據連接器定義會建立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 物件

最後,CCP 會利用數據連接器區段中的認證物件。

"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) 範本

除了範例範本之外,Microsoft Sentinel 內容中樞中提供的已發佈解決方案也會使用 CCP 作為其數據連接器。 請檢閱下列解決方案,以瞭解如何將元件合併成ARM範本的更多範例。

部署連接器

將您的無程式代碼連接器部署為自定義範本。

提示

刪除您在先前步驟中建立的資源。 DCR 和自定義數據表是使用部署建立的。 如果您在部署之前未移除這些資源,則驗證範本會比較困難。

  1. 複製 ARM 部署範本的內容。
  2. 請遵循使用 Azure 入口網站 建立和部署 ARM 範本一文中的編輯和部署範本指示。

維護記錄來源的網路隔離

如果您的記錄來源需要網路隔離,請設定 CCP 所使用的公用 IP 位址允許清單。

Azure 虛擬網路會使用服務標籤來定義網路存取控制。 對於CCP,該服務標籤是水肺

若要尋找與水肺服務標籤相關聯的目前IP範圍,請參閱使用服務標籤探索 API

確認無程式代碼連接器

在數據連接器資源庫中檢視無程式代碼連接器。 開啟數據連接器,並完成連線所需的任何驗證參數。 成功連線之後,就會建立 DCR 和自定義數據表。 檢視資源群組中的 DCR 資源,以及來自記錄分析工作區的任何自定義數據表。

注意

最多可能需要 30 分鐘才能看到數據開始擷取。

範例

建置無程式代碼連接器的每個步驟都會在下列範例小節中表示。

為了示範內嵌至多個數據表的複雜數據源,此範例具有輸出數據表架構,以及具有多個輸出數據流的 DCR。 DCR 範例會將這些專案與其 KQL 轉換放在一起。 數據連接器 UI 定義和連線規則範例會從這個相同的範例數據源繼續進行。 最後,解決方案範本會使用這些範例元件來顯示端對端如何建立範例 CCP 數據連接器。

範例數據

數據源在連線到其端點時會傳回下列 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"
        }
]

此回應包含eventType警示檔案。 檔案事件會內嵌至標準化標準數據表 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 ,並將輸出轉換成兩個數據表。

  1. 第一個數據流會將 eventType = 警示 導向至自定義 ExampleConnectorAlerts_CL 數據表。
  2. 第二個數據流會將eventType = 檔案導向標準化標準數據表。ASimFileEventLogs

如需此範例結構的詳細資訊,請參閱 數據收集規則的結構。

若要在測試環境中建立此 DCR,請遵循 資料收集規則 API。 中的 {{double curly braces}} 範例元素表示需要適用於Postman之值的變數。 當您在 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 部署範本,其中包含建置 CCP 資料連接器所需的 4 個 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 CCP 數據連接器建置元件。

  1. contentTemplates (父資源)
  2. data 連線 orDefinitions - 如需詳細資訊,請參閱數據連接器使用者介面
  3. 中繼資料
  4. contentTemplates
  5. 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')]"
            }
        }
        // that's the end!
    ]
}

下一步

如需更多資訊,請參閱