I have created two new PowerShell functions for Granting or Revoking permission on items in the Power BI Report Catalog. These two will be the probably be the last two functions I create for Power BI Report Server for a little while. I’ll be working on SSAS cmdlets for the next week or two.
I have recently created 4 new functions for working with Scheduled Refresh Plans (mostly covered here). As well as two more functions, one for Testing your DataSource connection, the other for inspecting the permissions for an item in the Report Catalog (mostly covered here). So, with these two, that makes 8 new functions this year. All of these functions have been built against the REST API, which is necessary for making them work in PowerShell 7.
Giant Thanks to Doug Finke!
I could not have created these two new functions ( Grant-RsRestItemAccessPolicy and Revoke-RsRestItemAccessPolicy ), without the help of Doug Finke ( b | t ). Doug Took a few minutes out of his busy schedule to teach me how to add & subtract (INSERT & DELETE) objects, and then convert them to the proper JSON payload. It was kind of crazy how fast he was able to create the working code.
Pester Tests are Important
Building these two new commands was also a lot faster because I didn’t really have to create new Pester Tests for them, per se. Instead, I took the existing Pester test for the old SOAP commands, created a copy, and basically sapped out the names. This was kind of a design goal too. I wanted to be able to prove that the two new commands could do the exact same operations that the two old commands could. How could I possibly prove this better than duplicating the existing Pester test?
You can now get all of these command from the ReportingServicesTools module in the PowerShell Gallery.
If you want to see for yourself the new commands that have been added, just run the code below (assuming you also downloaded the old version of the module at some point):
Import-Module ReportingServicesTools –RequiredVersion 0.0.5.8
$58 = Get-Command –Module ReportingServicesTools –CommandType Function
Import-Module ReportingServicesTools –RequiredVersion 0.0.6.4
$64 = Get-Command –Module ReportingServicesTools –CommandType Function
Compare-Object –ReferenceObject $58 –DifferenceObject $64 –Property Name –PassThru
About the Author:
I am a Senior SQL Server Architect with over 15 years experience in architecture, business intelligence, development, and performance tuning of SQL Server. Currently, I do a lot of data visualization work. I ❤ Power BI.
Check out my blog here.
Nelson, A. (2021). Grant or Revoke Permission on Power BI Report Server. Aailable at: https://sqlvariant.com/2021/02/grant-or-revoke-permission-on-power-bi-report-server/ [Accessed: 2nd March 2021].
Find more great Power Platform content here.