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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ajaquib
Frequent Visitor

How get the Database name, Server Name, Dataset, Report Name and Workspace Name using PowerShell

Need help in exporting Database name, Server Name, Dataset, Report Name and Workspace Name using PowerShell.

Can someone help me with the script?

1 ACCEPTED SOLUTION

$Workspaces = Get-PowerBIWorkspace -All
$Reports = ForEach ($workspace in $Workspaces) {
Write-Host $workspace.Name
ForEach ($report in (Get-PowerBIReport -WorkspaceId $workspace.Id)) {

ForEach ($datasource in (Get-PowerBIDatasource -DatasetId $report.DatasetId)) {
[pscustomobject]@{
WorkspaceID = $workspace.Id
WorkspaceName = $workspace.Name
ReportID = $report.Id
ReportName = $report.Name
DatasetID = $report.DatasetId
DataSourceName = $datasource.name
ConnectionString = $datasource.ConnectionString
ConnectionServer = $datasource.ConnectionDetails.Server
ConnectionDatabase = $datasource.ConnectionDetails.Database
ConnectionUrl = $datasource.ConnectionDetails.Url
GatewayID = $datasource.GatewayId
Datasoruceid = $datasource.DatasourceId
}
}
}
}
$Reports | Export-Csv -Path <mention path> -NoTypeInformation

View solution in original post

3 REPLIES 3
ajaquib
Frequent Visitor

Hi 

 

Need to extract the data using Powershell scripts.
Is it possible to get Database name, Server Name, Report Name and Workspace Name using Powershell script?
or Can we get list of Power BI report, workspace which are using specific datasource?

$Workspaces = Get-PowerBIWorkspace -All
$Reports = ForEach ($workspace in $Workspaces) {
Write-Host $workspace.Name
ForEach ($report in (Get-PowerBIReport -WorkspaceId $workspace.Id)) {

ForEach ($datasource in (Get-PowerBIDatasource -DatasetId $report.DatasetId)) {
[pscustomobject]@{
WorkspaceID = $workspace.Id
WorkspaceName = $workspace.Name
ReportID = $report.Id
ReportName = $report.Name
DatasetID = $report.DatasetId
DataSourceName = $datasource.name
ConnectionString = $datasource.ConnectionString
ConnectionServer = $datasource.ConnectionDetails.Server
ConnectionDatabase = $datasource.ConnectionDetails.Database
ConnectionUrl = $datasource.ConnectionDetails.Url
GatewayID = $datasource.GatewayId
Datasoruceid = $datasource.DatasourceId
}
}
}
}
$Reports | Export-Csv -Path <mention path> -NoTypeInformation

GilbertQ
Super User
Super User

Hi @ajaquib 

 

You can get this if you set up the scanner API, here is a blog post explaining how to get this done

 

https://powerbi.tips/2021/10/using-the-power-bi-scanner-api-to-manage-tenants-entire-metadata/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors