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
LuITS
Helper II
Helper II

semantic model - get datasources

Hello,

 

i want to retrive information on which reports use existing semantic modells as datasource.

 

More specifically, it concerns reports that are based on multiple semantic models and thus generate their own semantic model when uploaded to the service.

When I use PowerShell to retrieve the semantic models and display the IDs of the “source” semantic models using get datasources, these IDs do not match the IDs of the source semantic models.

 

Example:

Semantik Modell 1 -> ID 1

Semantik Modell 2 -> ID 2

Publish Report using both modells create semantik Modell 3 -> ID 3

When i retrive data for semantik model ID 3, get datasources give me different DatasourceID and not the expectes ID 1 and ID 2.
Example Output of semantic Modell with ID3:

Nameempty
ConnectionStringempty
DatasourceTypeAnalysisServices
ConnectionDetailsMircrosoft.PowerBI.Common.Api.Shared.DatasourceConnectionDetails
GatewayIde8gf98d89-23 ...
DatasourceId375fb943-99...


Why is this and how can i workaround?

 

1 ACCEPTED SOLUTION
tayloramy
Community Champion
Community Champion

Hi @LuITS

 

The DatasourceId you see from PowerShell/REST get datasources is not the semantic model (dataset) ID. It’s the bound data source ID (gateway/internal binding), so it won’t match your upstream semantic model GUIDs. That behavior is by design (docs).

  • For composite models (reports that stitch multiple semantic models), Power BI creates a local semantic model when you publish. To find the true upstream models behind that local model:
    1. Best (admin) method: use the Scanner API and read upstreamDatasets for the local model ID. That returns the real source semantic model IDs and workspaces (PostWorkspaceInfo, GetScanResult).
    2. Workspace-scope method: call Get-PowerBIDatasource on the local semantic model and inspect connectionDetails. For entries with datasourceType = AnalysisServices and server starting with powerbi://..., the connectionDetails.database identifies the upstream semantic model you can match in the Service (docs).

Deep dive

Why the IDs don’t match

  • DatasourceId in the Get Datasources response is defined as the bound data source ID, mainly used for gateway bindings; it is not the dataset/semantic model GUID (docs).
  • When you publish a report that references multiple semantic models, Power BI creates a local semantic model in your workspace (chaining). That local model then has AnalysisServices-type data sources pointing at other Power BI semantic models (composite models doc).

Two reliable ways to map local -> upstream semantic models

A) Tenant/Capacity admin approach (Scanner API) - most robust

  1. Trigger a scan:
# Requires Fabric admin rights (or service principal) and Admin API settings Connect-PowerBIServiceAccount $body = @{ workspaces = @(@{ id = "<workspace-guid>" }); lineage = $true } | ConvertTo-Json $start = Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/admin/workspaces/scan" -Method Post -Body $body $scanId = ($start | ConvertFrom-Json).id

do {
Start-Sleep -Seconds 2
$res = Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/admin/workspaces/scanStatus/$scanId
" -Method Get | ConvertFrom-Json
} until ($res.status -eq "Succeeded")

$result = Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/admin/workspaces/scanResult/$scanId
" -Method Get | ConvertFrom-Json
  1. For your local semantic model ID, read upstreamDatasets to get the actual sources. If it’s empty, make sure Admin API metadata settings are enabled in the Admin portal (setup guide).

B) Workspace-scope approach (no admin)

Connect-PowerBIServiceAccount

$compositeDatasetId = ""
$datasources = Get-PowerBIDatasource -DatasetId $compositeDatasetId

$upstream = foreach ($ds in $datasources) {
if ($ds.DatasourceType -eq "AnalysisServices" -and $ds.ConnectionDetails.Server -like "powerbi://*") {
[PSCustomObject]@{
SourceServer = $ds.ConnectionDetails.Server
SourceDatasetId = $ds.ConnectionDetails.Database
}
}
}

$upstream | Format-Table

 

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

View solution in original post

4 REPLIES 4
v-nmadadi-msft
Community Support
Community Support

Hi @LuITS 

As we haven’t heard back from you, we wanted to kindly follow up to check if the suggestions  provided by the community members for the issue worked. Please feel free to contact us if you have any further questions.

 

Thanks and regards

v-nmadadi-msft
Community Support
Community Support

Hi @LuITS 

May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.


Thank you

v-nmadadi-msft
Community Support
Community Support

Hi @LuITS 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.


Thank you.

tayloramy
Community Champion
Community Champion

Hi @LuITS

 

The DatasourceId you see from PowerShell/REST get datasources is not the semantic model (dataset) ID. It’s the bound data source ID (gateway/internal binding), so it won’t match your upstream semantic model GUIDs. That behavior is by design (docs).

  • For composite models (reports that stitch multiple semantic models), Power BI creates a local semantic model when you publish. To find the true upstream models behind that local model:
    1. Best (admin) method: use the Scanner API and read upstreamDatasets for the local model ID. That returns the real source semantic model IDs and workspaces (PostWorkspaceInfo, GetScanResult).
    2. Workspace-scope method: call Get-PowerBIDatasource on the local semantic model and inspect connectionDetails. For entries with datasourceType = AnalysisServices and server starting with powerbi://..., the connectionDetails.database identifies the upstream semantic model you can match in the Service (docs).

Deep dive

Why the IDs don’t match

  • DatasourceId in the Get Datasources response is defined as the bound data source ID, mainly used for gateway bindings; it is not the dataset/semantic model GUID (docs).
  • When you publish a report that references multiple semantic models, Power BI creates a local semantic model in your workspace (chaining). That local model then has AnalysisServices-type data sources pointing at other Power BI semantic models (composite models doc).

Two reliable ways to map local -> upstream semantic models

A) Tenant/Capacity admin approach (Scanner API) - most robust

  1. Trigger a scan:
# Requires Fabric admin rights (or service principal) and Admin API settings Connect-PowerBIServiceAccount $body = @{ workspaces = @(@{ id = "<workspace-guid>" }); lineage = $true } | ConvertTo-Json $start = Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/admin/workspaces/scan" -Method Post -Body $body $scanId = ($start | ConvertFrom-Json).id

do {
Start-Sleep -Seconds 2
$res = Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/admin/workspaces/scanStatus/$scanId
" -Method Get | ConvertFrom-Json
} until ($res.status -eq "Succeeded")

$result = Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/admin/workspaces/scanResult/$scanId
" -Method Get | ConvertFrom-Json
  1. For your local semantic model ID, read upstreamDatasets to get the actual sources. If it’s empty, make sure Admin API metadata settings are enabled in the Admin portal (setup guide).

B) Workspace-scope approach (no admin)

Connect-PowerBIServiceAccount

$compositeDatasetId = ""
$datasources = Get-PowerBIDatasource -DatasetId $compositeDatasetId

$upstream = foreach ($ds in $datasources) {
if ($ds.DatasourceType -eq "AnalysisServices" -and $ds.ConnectionDetails.Server -like "powerbi://*") {
[PSCustomObject]@{
SourceServer = $ds.ConnectionDetails.Server
SourceDatasetId = $ds.ConnectionDetails.Database
}
}
}

$upstream | Format-Table

 

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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