Forum Discussion
Premium per user - Loop through workspace and get Connection Strings
Hi TCavins,
Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.
Thank you.
I am unable to do anything with the Tabular Object Model. Anything that I take from examples, the server.Connect says invalid connection string.
I am able to create a token and authenticate with the API, but that does not give me the name of the views/tables etc that are in the datasources for each report.
- v-saisrao-msft11 months ago
Community Support
Hi TCavins,
I have done the repro at my and got the below output:
Below code should run in Powershell
Connect-PowerBIServiceAccount $workspaceId = "Enter your Workspacae ID here" $datasets = Get-PowerBIDataset -WorkspaceId $workspaceId foreach ($ds in $datasets) { Write-Host "===============================" Write-Host "Dataset: $($ds.Name)" Write-Host "===============================" # Datasources $urlDS = "https://api.powerbi.com/v1.0/myorg/groups/$workspaceId/datasets/$($ds.Id)/datasources" $sources = Invoke-PowerBIRestMethod -Url $urlDS -Method GET | ConvertFrom-Json $sources Write-Host "`nData Sources:" foreach ($s in $sources.value) { Write-Host " Type: $($s.datasourceType)" Write-Host " Server: $($s.connectionDetails.server)" Write-Host " Database: $($s.connectionDetails.database)" Write-Host "" } Write-Host "`n" }Thank you.
- TCavins11 months ago
Helper V
Yes, but that doesn't give me the actual name of the view.
- v-saisrao-msft10 months ago
Community Support
Hi TCavins,
Use XMLA endpoint to fetch Table names , View names (via partitions) and Data source query (M expression or SQL statement)
To Connect to the Workspace XMLA Endpoint You need
Premium Per User workspace
XMLA read or read/write enabled
NuGet package: Microsoft.AnalysisServices.Tabular
Connection to workspace XMLA endpoint
Documentation for connecting to Power BI models via XMLA
Below are the Official Microsoft Documentation for using TOM :
Programming Power BI semantic models with the Tabular Object Model (TOM) | Microsoft Learn
Tabular Object Model (TOM) | Microsoft Learn
Microsoft.AnalysisServices.Tabular Namespace | Microsoft Learn
Thank you.