

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 從 Microsoft Power BI 桌面連線至 Amazon DocumentDB
<a name="connect-odbc-power-bi"></a>

**Topics**
+ [先決條件](#odbc-power-bi-prerequisites)
+ [新增 Microsoft Power BI 桌面自訂連接器](#odbc-adding-power-bi)
+ [使用 Amazon DocumentDB 自訂連接器進行連線](#odbc-connect-custom-connector)
+ [設定 Microsoft Power BI Gateway](#odbc-power-bi-gw)

## 先決條件
<a name="odbc-power-bi-prerequisites"></a>

開始之前，請確定已正確安裝 Amazon DocumentDB ODBC 驅動程式。

## 新增 Microsoft Power BI 桌面自訂連接器
<a name="odbc-adding-power-bi"></a>

將`AmazonDocumentDBConnector.mez`檔案複製到 `<User>\Documents\Power BI Desktop\Custom Connectors\` 資料夾 （如果使用 OneDrive`<User>\OneDrive\Documents\Power BI Desktop\Custom Connectors`，則複製到 )。這將允許 Power BI 存取自訂連接器。您可以在[此](https://github.com/aws/amazon-documentdb-odbc-driver/releases)取得 Power BI 桌面的連接器。重新啟動 Power BI 桌面，以確保已載入連接器。

**注意**  
自訂連接器僅支援用於身分驗證的 Amazon DocumentDB 使用者名稱和密碼。

## 使用 Amazon DocumentDB 自訂連接器進行連線
<a name="odbc-connect-custom-connector"></a>

1. 從**取得資料**中選取 Amazon DocumentDB (Beta)，然後按一下**連線**。如果您收到使用第三方服務的警告，請按一下**繼續**。  
![使用 Amazon DocumentDB (Beta) 取得資料界面選項反白顯示。](http://docs.aws.amazon.com/zh_tw/documentdb/latest/developerguide/images/get-data-1.png)

1. 輸入所有必要資訊以連線至 Amazon DocumentDB 叢集，然後按一下**確定**：  
![具有 Amazon DocumentDB 叢集連線詳細資訊輸入欄位的表單。](http://docs.aws.amazon.com/zh_tw/documentdb/latest/developerguide/images/docdb-form-1.png)
**注意**  
如果您已在 DSN 設定中提供必要資訊，則可能不會顯示 SSH 連線詳細資訊畫面，視 ODBC 驅動程式的資料來源名稱 (DSN) 組態而定。

1. 選擇資料連線模式：
   + **匯入** - 載入所有資料並將資訊存放在磁碟上。必須重新整理並重新載入資料，才能顯示資料更新。
   + **直接查詢** - 不會載入資料，但會對資料進行即時查詢。這表示資料不需要重新整理和重新載入，才能顯示資料更新。  
![顯示 DocumentDB 之 Data Connectivity 模式選項的介面。](http://docs.aws.amazon.com/zh_tw/documentdb/latest/developerguide/images/data-connectivity-1.png)
**注意**  
如果您使用的是非常大型的資料集，匯入所有資料可能需要較長的時間。

1. 如果這是第一次連接到此資料來源，請選取身分驗證類型，並在出現提示時輸入您的憑證。然後按一下**連線**：  
![身分驗證介面會顯示使用者名稱和密碼登入資料的輸入欄位。](http://docs.aws.amazon.com/zh_tw/documentdb/latest/developerguide/images/docdb-credentials-1.png)

1. 在**導覽**器對話方塊中，選取所需的資料庫資料表，然後按一下**載入**以載入資料，或按一下**轉換資料**以繼續轉換資料。  
![導覽器界面顯示可供選擇的資料庫資料表清單。Load and Transform Data 按鈕位於右下角。](http://docs.aws.amazon.com/zh_tw/documentdb/latest/developerguide/images/navigator-1.png)
**注意**  
您的資料來源設定會在您連線後儲存。若要修改它們，請選取**轉換資料** > **資料來源設定**。

## 設定 Microsoft Power BI Gateway
<a name="odbc-power-bi-gw"></a>

**先決條件：**
+ 確定自訂連接器可與 Power BI Gateway 搭配使用。
+ 請確定 ODBC DSN 是在安裝 Power BI Gateway 之機器**的系統**索引標籤中的 ODBC 資料來源中建立。

如果您使用的是內部 SSH 通道功能，檔案`known_hosts`必須位於 Power BI 服務帳戶可存取該功能的位置。

![known_hosts 屬性界面顯示 PBIEgwService 的許可。](http://docs.aws.amazon.com/zh_tw/documentdb/latest/developerguide/images/ssh-known-hosts-1.png)


**注意**  
這也適用於您可能需要建立 Amazon DocumentDB 叢集連線的任何檔案 （例如憑證授權機構 (CA) 憑證檔案 (pem 檔案）。