Skip to main content
cancel
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.

Reply
baden27
Regular Visitor

How can i update my azure blob credentials in powerbi with SA access key (rest api)

Hi, I hope you can help me! How can i update my azure blob credentials in powerbi with SA access api (rest api) I keep getting a bad request.

 

 

 

foreach ($datasource in $datasources) {
    Write-Host $datasource.DatasourceType

    $gatewayId = $datasource.gatewayId

    $datasourceId = $datasource.datasourceId

    $ApiUrl = "https://api.powerbi.com/v1.0/myorg/gateways/$gatewayId/datasources/$datasourceId" 
    Write-Host "gatewayId $gatewayId" 
    Write-Host "datasourceId $datasourceId" 
    Write-Host "Patching url $datasourePatchUrl" 
    #Build the request body 
    

    $ApiRequestBody = @"
        {
            "credentialDetails": {
                "credentialType": "Key",
          "credentials": "{\"credentialData\":[{\"name\":\"key\", \"value\":\"ec....LA=\"}]}",
          "encryptedConnection": "Encrypted",
          "encryptionAlgorithm": "None",
          "privacyLevel": "None"
            }
        }
"@

    Invoke-PowerBIRestMethod -Url "gateways/$gatewayId/datasources/$datasourceId" -Method PATCH -Body $ApiRequestBody | ConvertFrom-Json -Verbose
    
}

 

 

 

1 REPLY 1
v-stephen-msft
Community Support
Community Support

Hi @baden27 ,

 

Please kindly refer to the similar post:

Solved: Re: Possible to update credentials via REST API? - Page 2 - Microsoft Power BI Community

The SET Credential API is for cloud datasources.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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