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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NithyaKB
Helper I
Helper I

Export all Workspaces and list of users - PowerShell

Hi ,
I have been trying to export all the workspaces and the list of users associated with the workpsace through Power shell.
Below is the code.
The code works fine and I am facing problem only when a AD group has been added to workspace. As long as the access has been given to individual users this code works fine and excel is generated with the list of users.But to those workspaces were groups are added in access tab it is just displaying groupid instead of group name .
Is there any possible workaround to display the group name along with individual users.

Connect-PowerBIServiceAccount
$Workspaces = Get-PowerBIWorkspace -Scope Organization -All 
$Workspaces | 
    ForEach-Object {
        $Workspace = $_.name
        foreach ($User in $_.Users) {
            [PSCustomObject]@{
                Workspace = $Workspace
                User      = $User.Identifier 
            }
        }
    } | Export-CSV "D:\\PowerBIReports.csv" -NoTypeInformation -Encoding UTF8

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @NithyaKB,

According to your description, I think only using the power bi module may not be suitable for your scenario.
In my opinion, I'd like to suggest you add additional steps before exporting data to check current items and extract the group id to use ActiveDirectory/AzureAD related functions to handle them.

ActiveDirectory Module | Microsoft Docs

AzureAD Module | Microsoft Docs

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @NithyaKB,

According to your description, I think only using the power bi module may not be suitable for your scenario.
In my opinion, I'd like to suggest you add additional steps before exporting data to check current items and extract the group id to use ActiveDirectory/AzureAD related functions to handle them.

ActiveDirectory Module | Microsoft Docs

AzureAD Module | Microsoft Docs

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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