分享方式:


建立 Microsoft Sentinel 的無程式碼連接器

無程式碼連接器平台 (CCP) 可讓合作夥伴、進階使用者和開發人員建立自訂連接器,以將資料擷取至 Microsoft Sentinel。

使用 CCP 所建立的連接器屬於完全的 SaaS,不需要安裝服務。 這些連接器還會包含來自 Microsoft Sentinel 的狀況監控 (部分機器翻譯) 和完整支援。

請使用下列步驟來建立您的 CCP 連接器,並將您的資料來源連線到 Microsoft Sentinel

  • 建置資料連接器
  • 建立 ARM 範本
  • 部署連接器
  • 將 Microsoft Sentinel 連線至資料來源並開始擷取資料

本文會說明如何完成每個步驟,並且會提供過程中要建置的範例無程式碼連接器

此 CCP 與舊版有何不同?

CCP 的最初版本是在 2022 年 1 月宣佈推出的。 之後,我們對平台做了改善,因此不再建議使用舊版本 (部分機器翻譯)。 這個新版的 CCP 具有下列重要改善:

  1. 對於各種驗證和分頁類型有更好的支援。

  2. 支援標準資料收集規則 (DCR)。

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

必要條件

在建置連接器之前,請先了解您的資料來源,以及 Sentinel Microsoft 必須以何種方式連線。

  1. 資料收集端點 (DCE)

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

  2. 輸出資料表的結構描述。

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

資料連接器 API 參考 (部分機器翻譯) 中研究下列元件並驗證其支援:

  1. 資料來源的 HTTP 要求和回應結構

  2. 資料來源所需的驗證。
    例如,如果您的資料來源需要以憑證簽署的權杖,則資料連接器 API 參考會指出憑證驗證不受支援。

  3. 資料來源的分頁選項

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

建置資料連接器

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

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

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

輸出資料表定義

提示

如果您的資料只會擷取至標準 Log Analytics 資料表,請略過此步驟。 標準資料表的範例包括「CommonSecurityLog」和「ASimDnsActivityLogs」。 如需所支援標準資料類型完整清單的詳細資訊,請參閱自訂資料連接器的資料轉換支援 (部分機器翻譯)。

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

  • 為所有資料建立自訂資料表
  • 為某些資料建立自訂資料表,並將符合規範的資料分割到標準資料表中

使用 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 定義。

使用資料連接器定義 API (部分機器翻譯) 建置資料連接器使用者介面。 使用資料連接器定義參考 (部分機器翻譯) 作為補充,以便更詳細地說明 API 元素。

注意:

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

使用 Postman 呼叫資料連接器定義 API 來建立資料連接器 UI,以便在資料連接器資源庫中驗證此項目。

若要從範例中學習,請參閱資料連接器定義參考範例一節 (部分機器翻譯)。

資料連線規則

這個部分會定義連線規則,包括:

  • 輪詢
  • 驗證 (authentication)
  • paging

如需如何建置此區段的詳細資訊,請參閱資料連接器連線規則參考 (部分機器翻譯)。

若要從範例中學習,請參閱資料連接器連線規則參考範例 (部分機器翻譯)。

使用 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,該服務標籤是 Scuba

若要尋找目前與 Scuba 服務標籤相關聯的 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. dataConnectorDefinitions - 如需詳細資訊,請參閱資料連接器使用者介面
  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!
    ]
}

下一步

如需更多資訊,請參閱