Datasets - Update Datasources In Group

Updates the data sources of the specified dataset from the specified workspace.

Note

We recommend using enhanced dataset metadata with this API call.

Important

  • The original data source and the new data source must have the exact same schema.
  • If you're using enhanced dataset metadata, refresh the dataset to get data from the new data sources.
  • If you're not using enhanced dataset metadata, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.

Permissions

Required Scope

Dataset.ReadWrite.All

Limitations

  • Datasets created or modified using the public XMLA endpoint aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.
  • Only these data sources are supported: SQL Server, Azure SQL Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and SAP HANA. For other data sources, use the Update Parameters In Group API call.
  • Changing the data source type isn't supported.
  • Data sources that contain parameters in the connection string aren't supported.
  • Updating data sources that are part of merged or joined tables is only supported if you're using enhanced dataset metadata.
  • For an Advanced Query that reference multiple data sources, only the first data source will be updated. To overcome this limitation, define the data source as a parameter and use the Update Parameters In Group API call.
  • Datasets with incremental refresh policy are not fully supported, calling this API may not work as expected and result of partial datasources update, to overcome this you can try run a dataset refresh before calling this API.

POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.UpdateDatasources

URI Parameters

Name In Required Type Description
datasetId
path True

string

groupId
path True

string

uuid

The workspace ID

Request Body

Name Required Type Description
updateDetails True

UpdateDatasourceConnectionRequest[]

An array of data source connection update requests

Responses

Name Type Description
200 OK

OK

Examples

Example

Sample Request

POST https://api.powerbi.com/v1.0/myorg/groups/f089354e-8366-4e18-aea3-4cb4a3a50b48/datasets/cfafbeb1-8037-4d0c-896e-a46fb27ff229/Default.UpdateDatasources
{
  "updateDetails": [
    {
      "datasourceSelector": {
        "datasourceType": "Sql",
        "connectionDetails": {
          "server": "My-Sql-Server",
          "database": "My-Sql-Database"
        }
      },
      "connectionDetails": {
        "server": "New-Sql-Server",
        "database": "New-Sql-Database"
      }
    },
    {
      "datasourceSelector": {
        "datasourceType": "OData",
        "connectionDetails": {
          "url": "http://services.odata.org/V4/Northwind/Northwind.svc"
        }
      },
      "connectionDetails": {
        "url": "http://services.odata.org/V4/Odata/Northwind.svc"
      }
    }
  ]
}

Sample Response

Definitions

Name Description
Datasource

A Power BI data source

DatasourceConnectionDetails

The Power BI data source connection details. See examples in Get Datasources or Get Datasources In Group.

UpdateDatasourceConnectionRequest

Power BI dataset data source connection update request

UpdateDatasourcesRequest

Power BI dataset data sources update request

Datasource

A Power BI data source

Name Type Description
connectionDetails

DatasourceConnectionDetails

The data source connection details

connectionString

string

(Deprecated) The data source connection string. Available only for DirectQuery.

datasourceId

string

The bound data source ID, which is empty when not bound to a gateway

datasourceType

string

The data source type

gatewayId

string

The bound gateway ID, which is empty when not bound to a gateway. When using a gateway cluster, the gateway ID refers to the primary (first) gateway in the cluster and is similar to the gateway cluster ID.

name

string

(Deprecated) The data source name. Available only for DirectQuery.

DatasourceConnectionDetails

The Power BI data source connection details. See examples in Get Datasources or Get Datasources In Group.

Name Type Description
account

string

The connection account

classInfo

string

The connection class information

database

string

The connection database

domain

string

The connection domain

emailAddress

string

The connection email address

kind

string

The connection kind

loginServer

string

The connection login server

path

string

The connection path

server

string

The connection server

url

string

The connection URL

UpdateDatasourceConnectionRequest

Power BI dataset data source connection update request

Name Type Description
connectionDetails

DatasourceConnectionDetails

The target connection details of the updated data source

datasourceSelector

Datasource

The connection details of the data source that needs update. This is mandatory when a dataset has more than one data source.

UpdateDatasourcesRequest

Power BI dataset data sources update request

Name Type Description
updateDetails

UpdateDatasourceConnectionRequest[]

An array of data source connection update requests