Forum Discussion
Premium per user - Loop through workspace and get Connection Strings
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.
Yes, but that doesn't give me the actual name of the view.
- v-saisrao-msft8 months agoCommunity 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.