透過內部部署資料閘道使用自訂資料連接器Use custom data connectors with the on-premises data gateway

注意

我們最近已修訂內部部署資料閘道文件。我們會將它們分割成 Power BI 的特定內容適用於所有閘道支援服務的一般內容We recently revised the on-premises data gateway docs. We split them into content that's specific to Power BI and general content that applies to all services that the gateway supports. 您目前正在瀏覽 Power BI 內容。You're currently in the Power BI content. 若要提供關於本文或整體閘道文件體驗的意見反應,請向下捲動至本文底部。To provide feedback on this article, or the overall gateway docs experience, scroll to the bottom of the article.

有了適用於 Power BI 的資料連接器,您可以連接並存取應用程式、服務或資料來源中的資料。With data connectors for Power BI, you can connect to and access data from an application, service, or data source. 您可以在 Power BI Desktop 中開發並使用自訂資料連接器。You can develop custom data connectors and use them in Power BI Desktop.

若要深入了解如何為 Power BI 開發自訂資料連接器,請參閱資料連接器 SDK GitHub 頁面To learn more about how to develop custom data connectors for Power BI, see the Data connector SDK GitHub page. 此網站包含 Power BI 和 Power Query 的開始使用方式和範例資訊。This site includes information on how to get started and samples for Power BI and Power Query.

當您在 Power BI Desktop 中建置使用自訂資料連接器的報表時,您可以使用內部部署資料閘道從 Power BI 服務重新整理這些報表。When you build reports in Power BI Desktop that use custom data connectors, you can use the on-premises data gateway to refresh those reports from the Power BI service.

啟用及使用此功能Enable and use this capability

當您安裝內部部署資料閘道的 2018 年七月版本或更新版本時,您會在內部部署資料閘道應用程式中看到 [連接器] 索引標籤。When you install the July 2018 version of the on-premises data gateway or a later version, you see a Connectors tab in the on-premises data gateway app. 在 [從資料夾載入自訂資料連線器] 方塊中,選取執行閘道服務之使用者可存取的資料夾。In the Load custom data connectors from folder box, select a folder that can be accessed by the user running the gateway service. 預設使用者是 NT SERVICE\PBIEgwServiceThe default user is NT SERVICE\PBIEgwService. 閘道會自動載入位於該資料夾中的自訂連接器檔案。The gateway automatically loads the custom connector files located in that folder. 它們會出現在資料連線器清單中。They appear in the list of data connectors.

自訂資料連接器

若您使用的是內部部署資料閘道 (個人模式),您就可以將 Power BI 報表上傳到 Power BI 服務,並使用閘道來加以重新整理。If you're using the on-premises data gateway (personal mode), you can upload your Power BI report to the Power BI service and use the gateway to refresh it.

針對內部部署資料閘道,您必須為您的自訂連接器建立資料來源。For the on-premises data gateway, you need to create a data source for your custom connector. 在 Power BI 服務的閘道設定頁面中,當您選取閘道叢集以允許透過此叢集使用自訂連接器時,您應該會看到選項。On the gateway settings page in the Power BI service, you should see an option when you select the gateway cluster to allow using custom connectors with this cluster. 確定叢集中的所有閘道都有 2018 年 7 月更新版或更新版本,才能使用此選項。Make sure all gateways in the cluster have the July 2018 update release or later for this option to be available. 選取該選項以允許透過此叢集使用自訂連接器。Select that option to enable using custom connectors with this cluster.

[閘道叢集設定] 頁面

啟用此選項時,您的自訂連接器會顯示為可在此閘道叢集下建立的可用資料來源。When this option is enabled, you see your custom connectors as available data sources that you can create under this gateway cluster. 在您建立使用新自訂連接器的資料來源之後,您可以在 Power BI 服務中使用該自訂連接器來重新整理 Power BI 報表。After you create a data source that uses your new custom connector, you can refresh Power BI reports by using that custom connector in the Power BI service.

[資料來源設定] 頁面

考量與限制Considerations and limitations

  • 請確定您所建立的資料夾可供背景閘道服務存取。Make sure the folder you create is accessible to the background gateway service. 一般而言,無法存取您使用者的 Windows 資料夾或系統資料夾下的資料夾。Typically, folders under your user’s Windows folder or system folders won’t be accessible. 如果無法存取資料夾,內部部署資料閘道應用程式會顯示一則訊息。The on-premises data gateway app shows a message if the folder isn't accessible. 此指示不適用於內部部署資料閘道 (個人模式)。This instruction doesn't apply for the on-premises data gateway (personal mode).
  • 若要讓自訂連接器使用內部部署資料閘道,它們需要在自訂連接器的程式碼中實作 "TestConnection" 區段。For custom connectors to work with the on-premises data gateway, they need to implement a “TestConnection” section in the custom connector’s code. 當您透過 Power BI Desktop 使用自訂連接器時,就不需要此區段。This section isn't required when you use custom connectors with Power BI Desktop. 基於此原因,您有一個可透過 Power BI Desktop 運作但無法透過閘道運作的連接器。For this reason, you can have a connector that works with Power BI Desktop, but not with the gateway. 如需如何實作 TestConnection 區段的詳細資訊,請參閱此文件For more information on how to implement a TestConnection section, see this documentation.
  • 目前僅針對閘道管理員支援透過閘道的 OAuth 自訂連接器,而針對其他資料來源使用者則不支援。OAuth for custom connectors via gateways is currently supported only for gateway admins but not other data source users.
  • 如果您的自訂連接器位於網路磁碟機上,請在內部部署的資料閘道應用程式中包含完整路徑。If your custom connector is on a network drive, include the fully qualified path on the on-premises data gateway app.

後續步驟Next steps

有其他問題嗎?More questions? 請嘗試詢問 Power BI 社群Try asking the Power BI Community.