Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I am writing a script that users can run to update all their DNS based analysis services connections to the new link:// alias style connection. The whole script is below:
#Requires -Version 5
Set-StrictMode -Version Latest
Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser
Import-Module MicrosoftPowerBIMgmt
Connect-PowerBIServiceAccount
try {
$groups = Invoke-PowerBiRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/groups/' -Method GET | ConvertFrom-Json
foreach ($group in $groups.value) {
Write-Host "Processing group $($group.name)"
$groupId = $group.id
$dataSets = Invoke-PowerBiRestMethod -Url "https://api.powerbi.com/v1.0/myorg/groups/$groupId/datasets" -Method GET | ConvertFrom-Json
foreach ($dataset in $datasets.value) {
Write-Host "Processing dataset $($dataset.name)"
$dataSetId = $dataset.id
$dataSourceUri = "https://api.powerbi.com/v1.0/myorg/groups/$groupId/datasets/$dataSetId/datasources"
$dataSources = Invoke-PowerBiRestMethod -Url $dataSourceUri -Method GET | ConvertFrom-Json
if (-not $dataSources) {
Resolve-PowerBIError -Last
continue
}
$updates = $dataSources.value |
Where-Object { $_.datasourceType -eq 'AnalysisServices' } |
Where-Object { $_.connectionDetails.server -match 'cube\.ds-\w*\.foobar\.com' } |
ForEach-Object {
$update = [pscustomobject] [ordered] @{
datasourceSelector = [pscustomobject] [ordered] @{
datasourceType = $_.datasourceType
connectionDetails = $_.connectionDetails
}
connectionDetails = [pscustomobject] [ordered] @{
server = "link://wibble.foobar.com"
database = $_.connectionDetails.database
}
}
Write-Output $update
}
if ($null -eq $updates)
{
continue
}
Write-Host "Found analysis services connections"
$updateDetails = @{
updateDetails = $updates
}
Write-Host "Updating connection details" -ForegroundColor Cyan
$body = $updateDetails | ConvertTo-Json -Depth 10
$url = "https://api.powerbi.com/v1.0/myorg/groups/$groupId/datasets/$dataSetId/Default.UpdateDatasources"
$updateResponse = Invoke-PowerBiRestMethod -Url $url -Method POST -Body $body -ErrorAction Stop | ConvertFrom-Json
Write-Output $updateResponse
}
}
}
catch {
Resolve-PowerBIError -Last
}The final post body looks fine according to the docs but I get a Bad Request response from the service.
With no additional clues I have no idea what to try next.
Did you have a resolution for this issue?
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 4 | |
| 3 | |
| 2 |