Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Release pipeline publish PowerBI report Azure DevOps failed at update datasource credentials



I am trying to set up a release pipeline in Azure DevOps to publish a PowerBI report. I followed this instruction:

and it all worked fine. 


However, I have added a second datasource to my report and now I can't get the pipeline to run. It keeps failing at the 'update datasource credentials' task. 


The first datasource is an Azure SQL database (credentialType = 'basic'). The second datasource is an Azure blob-storage (credentialType ='key').


Is it possible to use differente datasources and how do I update the credentials for the second datasource? I have tried to get it to work with only the blob-storage source, but that didn't work either. 


This is the Powershell code I use with only one datasource:


## user credentials
$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

## GetDataSets
$DatasetResponse=Invoke-PowerBIRestMethod -Url "groups/$($" -Method Get | ConvertFrom-Json

## Get DataSet
$datasets = $DatasetResponse.value

     foreach($dataset in $datasets){
                if($ -eq $datasetname){
                $datasetid= $;
Invoke-PowerBIRestMethod -Url "groups/$($$($datasetid)/Default.TakeOver" -Method Post

## update data source credentials
$BoundGateway=Invoke-PowerBIRestMethod -Url "groups/$($$($datasetid)/Default.GetBoundGatewayDataSources" -Method GET | ConvertFrom-Json 

$UpdateUserCredential = @{
            credentialType ="Basic"
            basicCredentials = @{            
            username= '$(username)'
            password= '$(secret)'
} | ConvertTo-Json

$response=Invoke-PowerBIRestMethod -Url "gateways/$($BoundGateway.value.gatewayId)/datasources/$($" -Method PATCH -Body $UpdateUserCredential | ConvertFrom-Json 



Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Kudoed Authors