Gateways - Create Datasource

在指定的內部部署閘道上建立新的資料來源。


內部部署資料來源認證必須加密。 參數 encryptedConnection 必須設定為 Encrypted ,而且應該使用閘道公開金鑰來加密認證。

如需使用此 API 的範例,請參閱 建立閘道 DataSource PowerShell 腳本,此腳本會使用下列附注中所述的 PowerShell 腳本來加密認證。

注意

若要加密認證,請參閱以 程式設計方式 設定 Power BI 的認證,並檢閱 EncryptCredentials .NET CoreJAVAPythonPowerShell 範例。

權限

僅支援內部部署閘道,且使用者必須具有閘道管理員許可權

必要範圍

Dataset.ReadWrite.All

限制

  • 不支援虛擬網路 (VNet) 和雲端閘道。
  • 不支援 OAuth2 作為認證類型。

POST https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}/datasources

URI 參數

名稱 位於 必要 類型 Description
gatewayId
path True

string

uuid

閘道識別碼。 使用閘道叢集時,閘道識別碼是指叢集中第一個) 閘道的主要 (。 在這種情況下,閘道識別碼類似于閘道叢集識別碼。

要求本文

名稱 必要 類型 Description
connectionDetails True

string

連線詳細資料

credentialDetails True

CredentialDetails

認證詳細資料

dataSourceName True

string

資料來源名稱

dataSourceType True

string

資料來源類型

回應

名稱 類型 Description
201 Created

GatewayDatasource

建立時間

範例

Azure Analysis Services example
SQL example

Azure Analysis Services example

Sample Request

POST https://api.powerbi.com/v1.0/myorg/gateways/1f69e798-5852-4fdd-ab01-33bb14b6e934/datasources
{
  "dataSourceType": "AnalysisServices",
  "connectionDetails": "{\"server\":\"MyServer\",\"database\":\"MyDatabase\"}",
  "datasourceName": "Sample Datasource",
  "credentialDetails": {
    "credentialType": "Windows",
    "credentials": "AB....EF==",
    "encryptedConnection": "Encrypted",
    "encryptionAlgorithm": "RSA-OAEP",
    "privacyLevel": "None"
  }
}

Sample Response

SQL example

Sample Request

POST https://api.powerbi.com/v1.0/myorg/gateways/1f69e798-5852-4fdd-ab01-33bb14b6e934/datasources
{
  "dataSourceType": "SQL",
  "connectionDetails": "{\"server\":\"MyServer\",\"database\":\"MyDatabase\"}",
  "datasourceName": "Sample Datasource",
  "credentialDetails": {
    "credentialType": "Windows",
    "credentials": "AB....EF==",
    "encryptedConnection": "Encrypted",
    "encryptionAlgorithm": "RSA-OAEP",
    "privacyLevel": "None"
  }
}

Sample Response

定義

名稱 Description
CredentialDetails

認證詳細資料

credentialType

資料來源認證的類型

encryptedConnection

是否要加密資料源連線。 如果您選取加密,且 Power BI 無法建立與資料來源的加密連線,API 呼叫將會失敗。

encryptionAlgorithm

加密演算法。 針對雲端資料來源,指定 None 。 針對內部部署資料來源,請指定 RSA-OAEP 並使用閘道公開金鑰來加密認證。

GatewayDatasource

Power BI 閘道資料來源

GatewayDatasourceCredentialDetails

資料來源認證詳細資料

privacyLevel

隱私權等級,這在結合多個來源的資料時相關。

PublishDatasourceToGatewayRequest

將資料來源發佈至閘道要求

CredentialDetails

認證詳細資料

名稱 類型 Description
credentialType

credentialType

認證類型

credentials

string

相依于 'credentialType' 值的認證。 如需詳細資訊,請參閱 更新資料來源 範例。

encryptedConnection

encryptedConnection

是否要加密資料源連線。 如果您選取加密,且 Power BI 無法建立與資料來源的加密連線,API 呼叫將會失敗。

encryptionAlgorithm

encryptionAlgorithm

加密演算法。 針對雲端資料來源,指定 None 。 針對內部部署資料來源,請指定 RSA-OAEP 並使用閘道公開金鑰來加密認證。

privacyLevel

privacyLevel

隱私權等級,這在結合多個來源的資料時相關。

useCallerAADIdentity

boolean

AZURE AD 身分識別 (OAuth 2.0 認證是否) API 呼叫端 (,這必須是資料來源擁有者) 將用來 (擁有者 OAuth 存取權杖) 設定資料來源認證。 一般而言,您會使用此旗標或 useEndUserOAuth2Credentials

useEndUserOAuth2Credentials

boolean

在 DirectQuery 模式中連接到資料來源時,是否使用終端使用者 Azure AD 身分識別 (OAuth 2.0 認證) 。 搭配支援 單一登入 (SSO) 的資料來源使用。 一般而言,您會使用此旗標或 useCallerAADIdentity

credentialType

資料來源認證的類型

名稱 類型 Description
Anonymous

string

Basic

string

Key

string

OAuth2

string

SAS

string

Windows

string

encryptedConnection

是否要加密資料源連線。 如果您選取加密,且 Power BI 無法建立與資料來源的加密連線,API 呼叫將會失敗。

名稱 類型 Description
Encrypted

string

NotEncrypted

string

encryptionAlgorithm

加密演算法。 針對雲端資料來源,指定 None 。 針對內部部署資料來源,請指定 RSA-OAEP 並使用閘道公開金鑰來加密認證。

名稱 類型 Description
None

string

RSA-OAEP

string

GatewayDatasource

Power BI 閘道資料來源

名稱 類型 Description
connectionDetails

string

JSON 格式的連線詳細資料

credentialDetails

GatewayDatasourceCredentialDetails

需要更新之資料來源的連接詳細資料。 當資料集有多個資料來源時,連線詳細資料是必要的。

credentialType

credentialType

資料來源認證的類型

datasourceName

string

資料來源的名稱。

datasourceType

string

資料來源的類型。

資料來源的 API 名稱
ActiveDirectory AdobeAnalytics AdoDotNet
AnalysisServices AzureBlobs AzureDataLakeStorage
AzureMarketplace AzureTables BizTalk
CDPA CustomConnector CustomHttpApi
DB2 Essbase EventHub
Excel Exchange 分機
Facebook 檔案 資料夾
GoogleAnalytics Hdfs HDInsight
Informix MQ MySql
OData ODBC OleDb
Oracle PostgreSql PowerQueryMashup
PubNub Salesforce SAPBW
SAPBWMessageServer SapErp SAPHana
SharePoint SharePointDocLib SharePointList
Sql Sybase Teradata
UIFlow Web
gatewayId

string

相關聯的閘道識別碼。 使用閘道叢集時,閘道識別碼是指叢集中第一個) 閘道的主要 (,類似于閘道叢集識別碼。

id

string

資料來源的唯一識別碼

GatewayDatasourceCredentialDetails

資料來源認證詳細資料

名稱 類型 Description
useEndUserOAuth2Credentials

boolean

在 DirectQuery 模式中連接到資料來源時,是否使用終端使用者 Azure AD 身分識別 (OAuth 2.0 認證) 。 搭配支援 單一登入 (SSO) 的資料來源使用。

privacyLevel

隱私權等級,這在結合多個來源的資料時相關。

名稱 類型 Description
None

string

Organizational

string

Private

string

Public

string

PublishDatasourceToGatewayRequest

將資料來源發佈至閘道要求

名稱 類型 Description
connectionDetails

string

連線詳細資料

credentialDetails

CredentialDetails

認證詳細資料

dataSourceName

string

資料來源名稱

dataSourceType

string

資料來源類型