0

Is there any way to get the list of users having powerbi access or how to check a particular user having the powerbi access using Microsoft.PowerBI.Api in .net core.

user3501613
  • 596
  • 7
  • 28

1 Answers1

0

You can use GetGroupUsersAsAdmin (The user must have administrator rights to use it) to get the list of users that have access to the specified workspace. If you don't have admin permission, you can use Get Group Users API. (Its response will also be similar to GetGroupUsersAsAdmin)

Example:

var client = new PowerBIClient(new Uri(pbiApiUrl), tokenCredentials);
client.Groups.GetGroupUsersAsync(GroupId);
client.Groups.GetGroupAsAdminAsync(GroupId);

The response will look something like this:

{
  "value": [
    {
      "displayName": "John Nick",
      "emailAddress": "john@contoso.com",
      "groupUserAccessRight": "Admin",
      "identifier": "john@contoso.com",
      "graphId": "3fadb6e4-130c-4a8f-aeac-416e38b66756",
      "principalType": "User"
    },
    {
      "displayName": "Adam Wood",
      "emailAddress": "Adam@contoso.com",
      "groupUserAccessRight": "Member",
      "identifier": "Adam@contoso.com",
      "graphId": "785e192c-0f1f-41ca-ae7a-a85da28e565a",
      "principalType": "User"
    },
    {
      "displayName": "ContosoTestApp",
      "groupUserAccessRight": "Admin",
      "identifier": "3d9b93c6-7b6d-4801-a491-1738910904fd",
      "graphId": "3d9b93c6-7b6d-4801-a491-1738910904fd",
      "principalType": "App"
    }
  ]
}

Reference:

https://learn.microsoft.com/rest/api/power-bi/admin/groups-get-group-users-as-admin

https://learn.microsoft.com/rest/api/power-bi/groups/get-group-users

Rahul Roy
  • 275
  • 1
  • 10