Forum Discussion

sarada's avatar
sarada
Frequent Visitor
2 years ago
Solved

Update data model role assignment (RLS) of PBI report using Powershell

Hi,  I need to dynamically update Row level security of power bi report that is deployed to PBIRS. I have used powershell script to get list of users in row level security but I could not find out h...
  • sarada's avatar
    2 years ago

    Issue here was about body of request.  I have tested the api using Postman and found out body of my resquest is not correct in PUT request. correct format of 

    $roleAssgnmtjson:

    [
    {
    "GroupUserName": "domain\User001",
    "DataModelRoles": ["2336b4a-e5b0-49ef-8556-62152375f005"]
    },
    {
    "GroupUserName": "domain\User002",
    "DataModelRoles": ["2336b4a-e5b0-49ef-8556-62152375f005"]
    }

    ]
    one point here is that 'DataModelRoles' is an array and I was trying to update that as text for new users: {
    "GroupUserName": "domain\User002",
    "DataModelRoles": "2336b4a-e5b0-49ef-8556-62152375f005"
    }
    this was another issue that I didn't notice because I had only one row level security in my report. 
    hope this help others with same issue