Gateways - Create Datasource

Creates a new datasource on the specified gateway.

Required scope: Dataset.ReadWrite.All
To set the permissions scope, see Register an app.

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

URI Parameters

Name In Required Type Description
gatewayId
path True
  • string
uuid

The gateway id

Request Body

Name Required Type Description
connectionDetails True
  • string

The connection details

credentialDetails True

The credential details

dataSourceName True
  • string

The datasource name

dataSourceType True
  • string

The datasource type

Responses

Name Type Description
201 Created

Created

Examples

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

Definitions

CredentialDetails

The credential details

credentialType

Type of the datasoruce credentials

encryptedConnection

User input for this attribute is currently ignored. Today, regardless of the provided value, we always try to establish an encrypted connection first but fall back to an unencrypted option in case of a failure.
This will be fixed for the following data source types with the June 2019 gateway release causing a value of Encrypted to try only an encrypted connection and NotEncrypted with an unencrypted connection and there would be no fallback behavior

  • Impala
  • MySql
  • DB2
  • Netezza
  • PostgreSQL
  • Sybase
  • Teradata
  • GoogleBigQuery
  • Amazon Redshift

encryptionAlgorithm

The encryption algorithm. For cloud datasource, use 'None'. For on-premises datasource, use gateway public key with 'RSA-OAEP' algorithm.

GatewayDatasource

A Power BI gateway datasource

privacyLevel

The privacy level. Relevant when combining data from multiple sources.

PublishDatasourceToGatewayRequest

A publish datasource to gateway request

CredentialDetails

The credential details

Name Type Description
credentialType

The credential type

credentials
  • string

The credentials. Depends on the 'credentialType' value. See Update Datasource Examples.

encryptedConnection

User input for this attribute is currently ignored. Today, regardless of the provided value, we always try to establish an encrypted connection first but fall back to an unencrypted option in case of a failure.
This will be fixed for the following data source types with the June 2019 gateway release causing a value of Encrypted to try only an encrypted connection and NotEncrypted with an unencrypted connection and there would be no fallback behavior

  • Impala
  • MySql
  • DB2
  • Netezza
  • PostgreSQL
  • Sybase
  • Teradata
  • GoogleBigQuery
  • Amazon Redshift

encryptionAlgorithm

The encryption algorithm. For cloud datasource, use 'None'. For on-premises datasource, use gateway public key with 'RSA-OAEP' algorithm.

privacyLevel

The privacy level. Relevant when combining data from multiple sources.

useCallerAADIdentity
  • boolean

Should the caller's AAD identity be used for OAuth2 credentials configuration

useEndUserOAuth2Credentials
  • boolean

Should the end-user OAuth2 credentials be used for connecting to the datasource in DirectQuery mode. Only supported for Direct Query to SQL Azure.

credentialType

Type of the datasoruce credentials

Name Type Description
Anonymous
  • string
Basic
  • string
Key
  • string
OAuth2
  • string
Windows
  • string

encryptedConnection

User input for this attribute is currently ignored. Today, regardless of the provided value, we always try to establish an encrypted connection first but fall back to an unencrypted option in case of a failure.
This will be fixed for the following data source types with the June 2019 gateway release causing a value of Encrypted to try only an encrypted connection and NotEncrypted with an unencrypted connection and there would be no fallback behavior

  • Impala
  • MySql
  • DB2
  • Netezza
  • PostgreSQL
  • Sybase
  • Teradata
  • GoogleBigQuery
  • Amazon Redshift

Name Type Description
Encrypted
  • string
NotEncrypted
  • string

encryptionAlgorithm

The encryption algorithm. For cloud datasource, use 'None'. For on-premises datasource, use gateway public key with 'RSA-OAEP' algorithm.

Name Type Description
None
  • string
RSA-OAEP
  • string

GatewayDatasource

A Power BI gateway datasource

Name Type Description
connectionDetails
  • string

Connection details in json format

credentialType

Type of the datasoruce credentials

datasourceName
  • string

The name of the datasource

datasourceType
  • string

The type of the datasource

gatewayId
  • string

The associated gateway id

id
  • string

The unique id for this datasource

privacyLevel

The privacy level. Relevant when combining data from multiple sources.

Name Type Description
None
  • string
Organizational
  • string
Private
  • string
Public
  • string

PublishDatasourceToGatewayRequest

A publish datasource to gateway request

Name Type Description
connectionDetails
  • string

The connection details

credentialDetails

The credential details

dataSourceName
  • string

The datasource name

dataSourceType
  • string

The datasource type