Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Below is my code to try and get the datasource names for all the datasources for every report in my power bi service. It is the workspace and dataset correctly but it is not getting the datasource name correctly. for datasource name it just returns a blank like so, "Datasource: ". But what it does do correctly is return the number of Datasources. So, for example if a report has 3 datasources it will return "Datasource: " 3 times. Any help would be very appreciated.
Install-Module -Name MicrosoftPowerBIMgmt.Data
Login-PowerBI
# Fetch all workspaces
$workspaces = Get-PowerBIWorkspace
foreach ($workspace in $workspaces) {
Write-Output "Workspace: $($workspace.Name)"
# Get datasets for each workspace
$datasets = Get-PowerBIDataset -WorkspaceId $workspace.Id
foreach ($dataset in $datasets) {
Write-Output " Dataset: $($dataset.Name)"
# Get datasources for each dataset in the current workspace
$datasources = Get-PowerBIDatasource -DatasetId $dataset.Id -WorkspaceId $workspace.Id
foreach ($datasource in $datasources) {
Write-Output " DataSource: $($datasource.Name)"
}
}
}
Solved! Go to Solution.
thank yall for the replies it turns out it was a permissions thing
Thanks momo_man. What permission were you missing?? I am Admin on the workspace and I am not getting Name and connectionstring
Hi @momo_man
Why do you not use the Power BI Scanner which will get all this information and more?
https://powerbi.tips/2021/10/using-the-power-bi-scanner-api-to-manage-tenants-entire-metadata/
Any idea how you would find the datasource names from the scan? I can't find it 😞
Maybe I will try this. I was trying to do this in less steps. Avoiding any azure interaction with api's with the module. If it worked it would serve its purpose. I just am trying to get the names of all datasources being used in my power bi service
Hello @momo_man, and thank you for starting a conversation in the Service Forum. Please mark this reply as a solution once the post is added to the PowerShell Forum.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
34 | |
21 | |
20 | |
14 | |
12 |
User | Count |
---|---|
23 | |
18 | |
18 | |
14 | |
14 |