cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Powershell API Export to File with RLS applied

I am trying to export a Power BI report to a PDF file using a powershell script.   The report exports fine when I leave out the powerBIReportConfiguration portion, but I get blank pages when I try to use an RLS role.  This makes me feel like I am doing it wrong.  Any help is appreciated.

    $body = '{"format":"PDF", 
              "powerBIReportConfiguration" : {"identities": [{ "username": "'+$user+ '",
                                                              "roles": [ "'+$role+'" ],
                                                              "datasets": [ "'+$datasetID+'" ]
                                                             }]
                                               }
              }'
    $url = "https://api.powerbi.com/v1.0/myorg/groups/"+$workspaceID+"/reports/"+$reportID+"/ExportTo"
    $export = Invoke-PowerBIRestMethod -Method POST -Url $url -Body $body -ContentType application/json | ConvertFrom-Json
    $exportID = $export.id

 

0 REPLIES 0

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.