Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Powershell + Who has access

Hi,
I am trying to export all accessrights for our organization for Power BI.

Workspace accessRight I can see I can get with powershell and Get-PowerBIWorkspace -Scope Organization
but how do I get accessrights for

- Datasets

- Reports 

- Apps


I have looked at 
Get-PowerBIDataset -Scope Organization
Get-PowerBIReport
but it looks like the accessrights is not included there.

 

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      I can't find anything related to access on app, dataset and report.
      Do you have any examples for that?

    • rinconpj's avatar
      rinconpj
      Frequent Visitor

      Hello,

       

      Did you find a solution? I have the same problem to have the information about datasets, dataflows...

       

      Thanks for the information.

       

      Kind regards,

      • Anonymous's avatar
        Anonymous
        Not applicable

        I exported the data with this code and have built a report on the output it in Power Bi.

         

        param(
        # Output path
        [string] $BasePath = "C:\_PowerBIService_Exports\"
        )

        Clear-Host
        Write-Host("Loading Apps.....Start")

        $filedate = $(Get-Date).toString("yyyyMMdd_HHmmss")
        $AppssourcesPath = $BasePath + "Apps\Apps_Output\" + $($filedate.Substring(0,8)) + "_Apps.json"
        $URL_APPS = "admin/apps?%24top=5000"

        # -------------------------------------------------------------------------
        # Start
        # -------------------------------------------------------------------------

        $Result_Apps = Invoke-PowerBIRestMethod -Url $URL_APPS -Method Get

        # Print output to file
        $Result_Apps | Out-File $AppssourcesPath

        #Convert from Json
        $Result_Apps = $Result_Apps | ConvertFrom-Json

        $counter = 0
        # Loop apps
        foreach($rec_apps in $Result_Apps.value)
        {
        Write-Host $rec_apps.id + $rec_apps.name

        $lv_appId = $rec_apps.id
        $URL_APP_ACCESS = "admin/apps/$lv_appId/users"
        $Result_App_Access = Invoke-PowerBIRestMethod -Url $URL_APP_ACCESS -Method GET

        $AppAccessSourcesPath = $BasePath + "Apps\AccessPerApp_Output\" + $($rec_apps.id) + "_Access.json"

        #Output - One file per app
        $Result_App_Access | Out-File $AppAccessSourcesPath

        # Count number of apps
        $counter = $counter + 1
        }

        Write-Host "Loading .....Done. Number of apps: $($counter)"