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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.