Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

New Member

UpdateDetails: Must be a non-empty collection

Hello everyone, im trying to update the datasource on some datasets, but i get the error in the title, it happens when i try to send a petition to this endpoint:{groupid}/datasets/{datasetid}/Default.UpdateDatasources
Im doing this with Powershell, and im constructing the json as an object first and then transforming it as a json, i created the file and passed it through jsonlint and it was okay, i've also checked the field UpdateDetails and its obviously not empty, to be honest, im kind of lost because there's also almost 0 information about this on the network.
This is my code:

Import-Module powershell-yaml
$AccessTokenParams = @{grant_type='refresh_token';refresh_token='my_refresh_token';client_id='my_app_client_id';client_secret='my_app_secret';scope=''}
$AccessToken = @{Authorization='Bearer ' + (Invoke-WebRequest -Uri -Method Post -Body $AccessTokenParams | ConvertFrom-Json).access_token}

$datasetIdList = ((((Invoke-WebRequest -Uri{groupid}/reports -Method Get -Headers $AccessToken).Content) | ConvertFrom-Yaml).value).datasetId
foreach ($dataset in $datasetIdList)
$datasource = ((Invoke-WebRequest -Uri{groupid}/datasets/$dataset/datasources -Method Get -Headers $AccessToken).Content)
if (-Not ($datasource -like "*unwantedsourcetochange1*") -And -Not ($datasource -like "*unwantedsourcetochange2*") -And -Not ([string]::IsNullOrEmpty(($datasource | ConvertFrom-Yaml).value))) {
$datasource = $datasource.replace('oldstring','newstring')
$updateDetails= @()
$connectionList = ($datasource | ConvertFrom-Yaml).value.connectionDetails
foreach ($connection in $connectionList){
$server = $connection.server
$path = $connection.path
$connectionObject = [PSCustomObject]@{
"server" = $server
"path" = $path
$datasourceSelector = [PSCustomObject]@{
"datasourceSelector" = @{
"datasourceType" = "AzureDataLakeStorage"
"connectionDetails" = $connectionObject
$connectionDetails = [PSCustomObject]@{
"connectionDetails" = $connectionObject
$updateDetails += $datasourceSelector
$updateDetails += $connectionDetails
$json = [PSCustomObject]@{
"updateDetails" = @($updateDetails)
$json = $json | ConvertTo-Json -Depth 100
if ($dataset -eq "specific-datasetid-i-want-to-change-for-testing-purposes") {
Invoke-WebRequest -Uri{groupid}/datasets/{specific datasetid}/Default.UpdateDatasources -Method Post -Body $json -Headers $AccessToken

Helpful resources

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.


Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.