Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Anonymous
Not applicable

REST API to get role names (RLS) from power bi service

Hello, I have two questions related to power bi report and dataset.

 

1. I have looked at the REST API site (https://docs.microsoft.com/pt-br/rest/api/power-bi/datasets/get-datasets-in-group) to look for an endpoint that returns a effective identity related roles that are defined through Power BI desktop development with no luck.  Does anyone know what endpoint can I use to retrieve that information? 

2. what are the differences between EffectiveIdentyRole and EffectiveIdentity? (see the below example Json from the website  
 

 

 

{
  "value": [
    {
      "id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229",
      "name": "SalesMarketing",
      "addRowsAPIEnabled": false,
      "configuredBy": "john@contoso.com",
      "isRefreshable": true,
      "isEffectiveIdentityRequired": false,
      "isEffectiveIdentityRolesRequired": false,
      "isOnPremGatewayRequired": false
    }
  ]
}

 

 

 Thanks! 

 

Sabrina

1 ACCEPTED SOLUTION
JZT
Frequent Visitor

Hi,

 

1. There is no Power BI REST API endpoint for this unfortunately. I've tried looking for the same and @lbendlin had pointed me in the DMV direction also. To expand on that, you can connect to the XMLA endpoint and run some queries. There are pros and cons. In case you want more info, here is some doco with examples: https://docs.microsoft.com/en-us/analysis-services/instances/use-dynamic-management-views-dmvs-to-mo...

 

Using the DMVs you can get roles, members, and the role filters per table, however only one view can be queried at a time with no joins allowed. I ended up building up data from the following DMVs:

 

$SYSTEM.TMSCHEMA_ROLES

$SYSTEM.TMSCHEMA_ROLE_MEMBERSHIPS

$SYSTEM.TMSCHEMA_TABLES

$SYSTEM.TMSCHEMA_TABLE_PERMISSIONS

 

Here's a link to my previous post if you're interested (there is a analysis.windows.net API endpoint you could call but I couldn't make it work): https://community.powerbi.com/t5/Developer/How-to-get-model-not-Dataset-ID-Part-of-getting-RLS-Roles...

 

2. From the doco (https://docs.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-datasets-as-admin#dataset)

 

IsEffectiveIdentityRequired

Whether the dataset requires an effective identity. This indicates that you must send an effective identity using the GenerateToken API.

IsEffectiveIdentityRolesRequired

Whether RLS is defined inside the PBIX file. This indicates that you must specify a role.

 

Hope that helped.

View solution in original post

8 REPLIES 8
volodymyr_zahid
New Member

PostWorkspaceInfo makes Power BI generate a scan of your workspace, which you can check for using GetScanStatus, then read using GetScanResult. The scan result contains information about row-level security roles https://learn.microsoft.com/en-us/rest/api/power-bi/admin/workspace-info-get-scan-result#definitions, including members of those roles and the RLS filters applied to those roles.  

Hi, would you be able to detail what flags you used when calling this Endpoint. I was not able to retrieve the row level security groups this way.

 

Many thanks.

Hi,

 

@volodymyr_zahid could you please detail how you retrieve the information? 

Thanks.

JZT
Frequent Visitor

Hi,

 

1. There is no Power BI REST API endpoint for this unfortunately. I've tried looking for the same and @lbendlin had pointed me in the DMV direction also. To expand on that, you can connect to the XMLA endpoint and run some queries. There are pros and cons. In case you want more info, here is some doco with examples: https://docs.microsoft.com/en-us/analysis-services/instances/use-dynamic-management-views-dmvs-to-mo...

 

Using the DMVs you can get roles, members, and the role filters per table, however only one view can be queried at a time with no joins allowed. I ended up building up data from the following DMVs:

 

$SYSTEM.TMSCHEMA_ROLES

$SYSTEM.TMSCHEMA_ROLE_MEMBERSHIPS

$SYSTEM.TMSCHEMA_TABLES

$SYSTEM.TMSCHEMA_TABLE_PERMISSIONS

 

Here's a link to my previous post if you're interested (there is a analysis.windows.net API endpoint you could call but I couldn't make it work): https://community.powerbi.com/t5/Developer/How-to-get-model-not-Dataset-ID-Part-of-getting-RLS-Roles...

 

2. From the doco (https://docs.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-datasets-as-admin#dataset)

 

IsEffectiveIdentityRequired

Whether the dataset requires an effective identity. This indicates that you must send an effective identity using the GenerateToken API.

IsEffectiveIdentityRolesRequired

Whether RLS is defined inside the PBIX file. This indicates that you must specify a role.

 

Hope that helped.

Anonymous
Not applicable

Hi, just found. In our server worked: pbi.com...api/v2.0/PowerBIReports({Report ID})/DataModelRoles

Anonymous
Not applicable

Thank you!

lbendlin
Super User
Super User

You can get the RLS roles through DMV queries against the XMLA endpoint.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.