將事件中樞事件來源新增至您的 Azure 時間序列深入解析環境Add an event hub event source to your Azure Time Series Insights environment

此文章說明如何使用 Azure 入口網站,將從 Azure 事件中樞讀取資料的事件來源新增至您的 Azure 時間序列深入解析環境。This article describes how to use the Azure portal to add an event source that reads data from Azure Event Hubs to your Azure Time Series Insights environment.

注意

本文所述的步驟適用于 Azure 時間序列深入解析 Gen 1 和 Azure 時間序列深入解析 Gen 2 環境。The steps that are described in this article apply both to the Azure Time Series Insights Gen 1 and Azure Time Series Insights Gen 2 environments.

必要條件Prerequisites

將取用者群組新增至事件中樞Add a consumer group to your event hub

應用程式會使用取用者群組從 Azure 事件中樞提取資料。Applications use consumer groups to pull data from Azure Event Hubs. 若要可靠地從事件中樞讀取資料,請提供僅供此 Azure 時間序列深入解析環境使用的專用取用者群組。To reliably read data from your event hub, provide a dedicated consumer group that's used only by this Azure Time Series Insights environment.

將新的取用者群組新增至事件中樞:To add a new consumer group in your event hub:

  1. Azure 入口網站中,從事件中樞命名空間的 [ 總覽 ] 窗格中,找出並開啟您的事件中樞實例。In the Azure portal, locate and open your event hub instance from the Overview pane of your event hub namespace. 選取 [ 實體] > 事件中樞 ,或在 [ 名稱] 底下尋找您的實例。Select Entities > Event Hubs or find your instance under Name.

    開啟您的事件中樞命名空間Open your event hub namespace

  2. 在您的事件中樞實例中,選取 [ 實體 > 取用者群組]。In your event hub instance, select Entities > Consumer groups. 然後,選取 [ + 取用者群組 ] 以新增取用者群組。Then, select + Consumer group to add a new consumer group.

    事件中樞-新增取用者群組Event hub - Add a consumer group

    否則,請選取現有的取用者群組,並跳至下一節。Otherwise, select an existing consumer group and skip to the next section.

  3. 在 [取用者群組] 頁面上,在 [名稱] 中輸入新的唯一值。On the Consumer groups page, enter a new unique value for Name. 當您在 Azure 時間序列深入解析環境中建立新的事件來源時,請使用相同的名稱。Use this same name when you create a new event source in the Azure Time Series Insights environment.

  4. 選取 [建立] 。Select Create.

新增事件來源Add a new event source

  1. 登入 Azure 入口網站Sign in to the Azure portal.

  2. 找出您現有的 Azure 時間序列深入解析環境。Locate your existing Azure Time Series Insights environment. 在左側功能表中,選取 [ 所有資源],然後選取您的 Azure 時間序列深入解析環境。In the left menu, select All resources, and then select your Azure Time Series Insights environment.

  3. 選取 [ 事件來源],然後選取 [ 新增]。Select Event Sources, and then select Add.

    在 [事件來源] 下,選取 [加入] 按鈕Under Event Sources, select the Add button

  4. 輸入此 Azure 時間序列深入解析環境唯一的 [ 事件來源名稱 ] 值,例如 Contoso-TSI-Gen 1-Event-Hub-ESEnter a value for Event source name that is unique to this Azure Time Series Insights environment, such as Contoso-TSI-Gen 1-Event-Hub-ES.

  5. 在 [來源] 中,選取 [事件中樞]。For Source, select Event Hub.

  6. 為 [匯入選項] 選取適當的值:Select the appropriate values for Import option:

    • 若您的其中一個訂用帳戶中有現有的事件中樞,請選取 [來自可用訂閱的使用事件中樞]。If you have an existing event hub in one of your subscriptions, select Use Event Hub from available subscriptions. 此選項是最簡單的方法。This option is the easiest approach.

      選取事件來源匯入選項Select an Event Source import option

    • 下表說明 [來自可用訂閱的使用事件中樞] 選項的必要屬性:The following table describes the required properties for the Use Event Hub from available subscriptions option:

      訂用帳戶和事件中樞詳細資料Subscription and event hub details

      屬性Property 描述Description
      訂用帳戶Subscription 所需的事件中樞實例和命名空間所屬的訂用帳戶。The subscription the desired event hub instance and namespace belongs to.
      事件中樞命名空間Event Hub namespace 所需事件中樞實例所屬的事件中樞命名空間。The event hub namespace the desired event hub instance belongs to.
      事件中樞名稱Event Hub name 所需事件中樞實例的名稱。The name of the desired event hub instance.
      事件中樞原則值Event Hub policy value 選取所需的共用存取原則。Select the desired shared access policy. 您可以在 [事件中樞 設定 ] 索引標籤上建立共用存取原則。每個共用存取原則都有名稱、您設定的許可權,以及存取金鑰。You can create the shared access policy on the event hub Configure tab. Each shared access policy has a name, permissions that you set, and access keys. 事件來源的共用存取原則必須有 讀取 權限。The shared access policy for your event source must have read permissions.
      事件中樞原則金鑰Event Hub policy key 從選取的事件中樞原則值預先填入。Pre-populated from the selected Event Hub policy value.
    • 若事件中樞對於您的訂用帳戶而言是外部,或您想要選取進階選項,請選取 [手動提供事件中樞設定]。If the event hub is external to your subscriptions or if you want to select advanced options, select Provide Event Hub settings manually.

      下表說明 [手動提供事件中樞設定] 選項的必要屬性:The following table describes the required properties for the Provide Event Hub settings manually option:

      屬性Property 描述Description
      訂用帳戶識別碼Subscription ID 所需的事件中樞實例和命名空間所屬的訂用帳戶。The subscription the desired event hub instance and namespace belongs to.
      資源群組Resource group 所需事件中樞實例和命名空間所屬的資源群組。The resource group the desired event hub instance and namespace belongs to.
      事件中樞命名空間Event Hub namespace 所需事件中樞實例所屬的事件中樞命名空間。The event hub namespace the desired event hub instance belongs to.
      事件中樞名稱Event Hub name 所需事件中樞實例的名稱。The name of the desired event hub instance.
      事件中樞原則值Event Hub policy value 選取所需的共用存取原則。Select the desired shared access policy. 您可以在 [事件中樞 設定 ] 索引標籤上建立共用存取原則。每個共用存取原則都有名稱、您設定的許可權,以及存取金鑰。You can create the shared access policy on the event hub Configure tab. Each shared access policy has a name, permissions that you set, and access keys. 事件來源的共用存取原則必須有 讀取 權限。The shared access policy for your event source must have read permissions.
      事件中樞原則金鑰Event Hub policy key 用來驗證服務匯流排命名空間之存取權的共用存取金鑰。The shared access key that's used to authenticate access to the Service Bus namespace. 在這裡輸入主要金鑰或次要金鑰。Enter the primary or secondary key here.
    • 這兩個選項都會共用下列設定選項:Both options share the following configuration options:

      屬性Property 描述Description
      事件中樞取用者群組Event Hub consumer group 從事件中樞讀取事件的取用者群組。The consumer group that reads events from the event hub. 強烈建議您使用專屬於您事件來源的取用者群組。We highly recommend that you use a dedicated consumer group for your event source.
      事件序列化格式Event serialization format 目前,JSON 是目前唯一可用的序列化格式。Currently, JSON is the only available serialization format. 事件訊息必須是這種格式,否則無法讀取資料。Event messages must be in this format or data can't be read.
      時間戳記屬性名稱Timestamp property name 若要判斷此值,您需要了解傳送至事件中樞之訊息資料的訊息格式。To determine this value, you need to understand the message format of the message data that's sent to the event hub. 這個值是您想要使用作為事件時間戳記之訊息資料中特定事件屬性的 名稱This value is the name of the specific event property in the message data that you want to use as the event timestamp. 此值區分大小寫。The value is case-sensitive. 若保留空白,會使用事件來源中的 事件加入佇列時間 作為事件時間戳記。If left blank, the event enqueue time in the event source is used as the event timestamp.
  7. 新增您新增至事件中樞的專用 Azure 時間序列深入解析取用者組名。Add the dedicated Azure Time Series Insights consumer group name that you added to your event hub.

  8. 選取 [建立] 。Select Create.

    建立事件來源之後,Azure 時間序列深入解析會自動開始將資料串流至您的環境。After the event source is created, Azure Time Series Insights automatically begins streaming data to your environment.

下一步Next steps