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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power BI Action: Update Datasource Connection (Operation is not supported for selector #4)

Hi, 

 

I am trying to setup Power BI CICD in Azure DevOps. I am using Power BI Action to publish report and update datasource connection.

I am able to update datasource connection for the first datasource after thaT THIS ERROR COMES WHEN i TRY TO UPDATE FOR THE OTHER DATASETS.

All the datasets are from same server and database.

 

2020-04-12T01:34:19.8820835Z ##[section]Starting: Power BI Action: UpdateDatasource
2020-04-12T01:34:19.8914968Z ==============================================================================
2020-04-12T01:34:19.8915447Z Task         : Power BI Actions
2020-04-12T01:34:19.8915838Z Description  : Release Task Power BI Actions
2020-04-12T01:34:19.8916195Z Version      : 4.0.9
2020-04-12T01:34:19.8916376Z Author       : Maik van der Gaag
2020-04-12T01:34:19.8916553Z Help         :
2020-04-12T01:34:19.8916785Z ==============================================================================
2020-04-12T01:34:20.6617949Z ******************************
2020-04-12T01:34:20.6625224Z ** Service Connection: <name>
2020-04-12T01:34:20.6632505Z ** TenantId: ***
2020-04-12T01:34:20.6636813Z ** ClientId: ***
2020-04-12T01:34:20.6642299Z ******************************
2020-04-12T01:34:20.7485274Z FilePattern           : D:\a\r1\a
2020-04-12T01:34:20.7488970Z ClientID           : ***
2020-04-12T01:34:20.7522957Z PassWord             : <not present>
2020-04-12T01:34:20.7525953Z Username              :
2020-04-12T01:34:20.7529197Z WorkspaceName         : <workspacename>
2020-04-12T01:34:20.7532405Z Overwrite             : True
2020-04-12T01:34:20.7535433Z Create                : True
2020-04-12T01:34:20.7538503Z Action                : UpdateDatasource
2020-04-12T01:34:20.7541587Z Dataset               : <datasource name>
2020-04-12T01:34:20.7544434Z Users                 :
2020-04-12T01:34:20.7547399Z AccessRight           :
2020-04-12T01:34:20.7550362Z OldServer             : <name>.database.windows.net
2020-04-12T01:34:20.7553267Z NewServer             : <name>.database.windows.net
2020-04-12T01:34:20.7556159Z OldDatabase           : <name>-dev
2020-04-12T01:34:20.7559020Z NewDatabase           : <name>-tst
2020-04-12T01:34:20.7561882Z OldUrl                :
2020-04-12T01:34:20.7565337Z NewUrl                :
2020-04-12T01:34:20.7568496Z DatasourceType        : Sql
2020-04-12T01:34:20.7572075Z UpdateAll             : False
2020-04-12T01:34:20.7584450Z ClientSecret          : System.Security.SecureString
2020-04-12T01:34:20.7588361Z TenantId              : ***
2020-04-12T01:34:20.7591275Z Service Principals    :
2020-04-12T01:34:20.7610332Z Logging in with a Service Principal
2020-04-12T01:34:21.5151681Z Trying to update the datasource
2020-04-12T01:34:21.5301283Z Getting Power BI Workspace properties; <workspacename>
2020-04-12T01:34:23.5655273Z ##[error]Operation is not supported for selector #4
2020-04-12T01:34:23.6131640Z ##[section]Finishing: Power BI Action: UpdateDatasource

2 REPLIES 2
Jayendran
Solution Sage
Solution Sage

Anonymous
Not applicable

I was using the following PowerShell script to update data source connection.

 

$datasetname="Dashboard Dataset"

$workspacename="REPORT_TEST"

 

$clientsec = "$(client_secret)" | ConvertTo-SecureString -AsPlainText -Force

 

$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:client_id, $clientsec

Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId $env:tenant_id

 

$workspace =Get-PowerBIWorkspace -Name $workspacename

 

$DatasetResponse=Invoke-PowerBIRestMethod -Url "groups/$($workspace.id)/datasets" -Method Get | ConvertFrom-Json

 

 

$datasets = $DatasetResponse.value

 

     foreach($dataset in $datasets){

                if($dataset.name -eq $datasetname){

                $datasetid= $dataset.id;

                break;

                }

 

            }

 

   $postParams = @{

            updateDetails =@(

            @{

            name="database"

            newValue="db-test"

            } ,

             @{

            name="server"

            newValue="server-test"

            }

 

            )

} | ConvertTo-Json

 

Invoke-PowerBIRestMethod -Url "groups/$($workspace.id)/datasets/$($datasetid)/Default.TakeOver" -Method Post

 

$response=Invoke-PowerBIRestMethod -Url "groups/$($workspace.id)/datasets/$($datasetid)/Default.UpdateParameters" -Method Post -Body $postParams | ConvertFrom-Json

 

And its giving error

2020-04-13T23:33:46.3600483Z ##[section]Starting: Update parameters for dataset

2020-04-13T23:33:46.3816028Z ==============================================================================

2020-04-13T23:33:46.3816393Z Task         : PowerShell

2020-04-13T23:33:46.3816710Z Description  : Run a PowerShell script on Linux, macOS, or Windows

2020-04-13T23:33:46.3817021Z Version      : 2.165.0

2020-04-13T23:33:46.3817293Z Author       : Microsoft Corporation

2020-04-13T23:33:46.3817666Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell

2020-04-13T23:33:46.3818127Z ==============================================================================

2020-04-13T23:33:47.1929102Z Generating script.

2020-04-13T23:33:47.2347065Z ========================== Starting Command Output ===========================

2020-04-13T23:33:47.2609972Z ##[command]"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\236958ca-ebd7-43a5-8876-a6505f0a70ea.ps1'"

2020-04-13T23:33:49.0798312Z 

2020-04-13T23:33:49.0799535Z 

2020-04-13T23:33:49.0802661Z Environment : Public

2020-04-13T23:33:49.0803552Z TenantId    : 

2020-04-13T23:33:49.0804332Z ClientId    : ***

2020-04-13T23:33:49.0804530Z Password    : ********

2020-04-13T23:33:49.0804683Z 

2020-04-13T23:33:50.0959876Z WARNING: The Body parameter was null, the request may be invalid when Method parameter is Post.

2020-04-13T23:33:50.4406494Z 

2020-04-13T23:33:51.1154649Z Invoke-PowerBIRestMethod : One or more errors occurred.

2020-04-13T23:33:51.1155801Z At D:\a\_temp\236958ca-ebd7-43a5-8876-a6505f0a70ea.ps1:37 char:11

2020-04-13T23:33:51.1156390Z + $response=Invoke-PowerBIRestMethod -Url "groups/$($workspace.id)/data ...

2020-04-13T23:33:51.1156920Z +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2020-04-13T23:33:51.1157537Z     + CategoryInfo          : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIR 

2020-04-13T23:33:51.1158077Z    estMethod], AggregateException

2020-04-13T23:33:51.1158601Z     + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

2020-04-13T23:33:51.1159039Z  

2020-04-13T23:33:51.1505339Z 

2020-04-13T23:33:51.1505696Z 

2020-04-13T23:33:51.1984740Z ##[section]Finishing: Update parameters for dataset

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.