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.
Hello,
Admin - Datasets GetDatasourcesAsAdmin API (https://learn.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-datasources-as-admin?tryIt=tr...) has been listing wrong Datasources Information when it is iterated with the DatasetIDs from the Admin - Datasets GetDatasetsAsAdmin API (https://learn.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-datasets-as-admin).
Below is the code snippet of how I'm iterating using PowerShell. I'm authenticating using Service Principal which has the required permissions.
//
$DatasetsAPI = "https://api.powerbi.com/v1.0/myorg/admin/datasets"
$Datasets = Invoke-RestMethod -Uri $DatasetsAPI -Headers $headers -Method GET -ContentType "application/json"
$DatasetID = $Datasets.value.id
# Forloop to retrieve Datasource info for each DataSetID
foreach ($Id in $DatasetID){
$DatasourceAPI = "https://api.powerbi.com/v1.0/myorg/admin/datasets/$Id/datasources"
try {
$Datasource = Invoke-RestMethod -Uri $DatasourceAPI -Headers $headers -Method GET -ContentType "application/json"
}
Catch {
$Datasource.value | select-object datasourceType, datasourceId, gatewayId, connectionDetails, @{n="DataSetID";e={$Id}}| Export-csv $ErrorPath -NoTypeInformation -Append -force
$iserror = $true
}
#Writes the Final output to a csv file
finally {
$Datasource.value | select-object datasourceType, datasourceId, gatewayId, connectionDetails, @{n="DataSetID";e={$Id}} | Export-csv $Path -NoTypeInformation -Append -force
}
$Datasource = $null
}
//
As for the result, the following dataset ID shows the connection details as '@{path=Goals; kind=Goals}' and when we run the same API in MSFT website it shows the actual results. This has been inconsistent in terms of the Dataset IDs that it will output the Connection details with this process.
If anyone has come across this use case and has a solution would be helpful. Thanks in advance!
Hello, Trying to resurface this post to see if anyone knows of any solution. Thanks!
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 |
---|---|
4 | |
4 | |
3 | |
3 | |
2 |