Gateways - Add Datasource User

Grants or updates the permissions required to use the specified datasource for the specified user.

Note: This API requires gateway admin permissions.

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/{datasourceId}/users

URI Parameters

Name In Required Type Description
datasourceId
path True
  • string
uuid

The datasource ID

gatewayId
path True
  • string
uuid

The gateway ID. When using a gateway cluster, the gateway ID refers to the primary (first) gateway in the cluster. In such cases, gateway ID is similar to gateway cluster ID.

Request Body

Name Required Type Description
datasourceAccessRight True

The user access rights for the datasource.

displayName
  • string

Display name of the principal

emailAddress
  • string

Email address of the user

identifier
  • string

Object ID of the principal

principalType

The principal type

Responses

Name Type Description
200 OK

OK

Examples

example
example for giving ReadOverrideEffectiveIdentity access right to a service principal

example

Sample Request

POST https://api.powerbi.com/v1.0/myorg/gateways/1f69e798-5852-4fdd-ab01-33bb14b6e934/datasources/252b9de8-d915-4788-aaeb-ec8c2395f970/users
{
  "emailAddress": "john@contoso.com",
  "datasourceAccessRight": "Read"
}

Sample Response

example for giving ReadOverrideEffectiveIdentity access right to a service principal

Sample Request

POST https://api.powerbi.com/v1.0/myorg/gateways/1f69e798-5852-4fdd-ab01-33bb14b6e934/datasources/252b9de8-d915-4788-aaeb-ec8c2395f970/users
{
  "identifier": "3d9b93c6-7b6d-4801-a491-1738910904fd",
  "datasourceAccessRight": "ReadOverrideEffectiveIdentity"
}

Sample Response

Definitions

DatasourceUser

A Power BI user access right entry for datasource

DatasourceUserAccessRight

The user access rights for the datasource.

PrincipalType

The principal type

DatasourceUser

A Power BI user access right entry for datasource

Name Type Description
datasourceAccessRight

The user access rights for the datasource.

displayName
  • string

Display name of the principal

emailAddress
  • string

Email address of the user

identifier
  • string

Object ID of the principal

principalType

The principal type

DatasourceUserAccessRight

The user access rights for the datasource.

Name Type Description
None
  • string

Removes permission to access the datasource. Only applies when updating user permissions.

Read
  • string

Indicates that datasets owned by the user has read access to this datasource.

ReadOverrideEffectiveIdentity
  • string

Indicates that user can override effective identity for Power BI Embedded.

PrincipalType

The principal type

Name Type Description
App
  • string

Service principal type

Group
  • string

Group principal type

None
  • string

None principal type, used for whole organization level access.

User
  • string

User principal type