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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
data_turke
Regular Visitor

Rotating Databricks PAT for Power BI Gateway datasource via REST API (RSA-OAEP encrypted creds)

Context

  1. I’m using a service principal that has:

  • Power BI Admin role

  • Gateway Admin on the target Enterprise Gateway

  • Admin on the specific datasource/connection

  • The necessary API permissions (per MS docs for Gateways/Datasources)

Docs I’m following: https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource#examples

  1. We rotate PAT tokens in Databricks on a schedule and want to update the corresponding Power BI gateway datasource (non-VNet gateway) whenever the PAT changes.

  2. I used the sample from the Microsoft “Encrypt credentials” repo to encrypt the payload with the gateway’s public key:
    https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials

Goal

Automate PATCH /gateways/{gatewayId}/datasources/{datasourceId} to update the Databricks PAT for an existing gateway datasource.

 

Wondering if i an get some help with REST API i get this error no matter what i try - "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "

Sample payload 

 
"credentialDetails": {
"credentialType": "Key",
"credentials": "{\"credentialData\":[{\"name\":\"key\", \"value\":\"adad==\"}]}",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "RSA-OAEP",
"privacyLevel": "None"
}
 

1 REPLY 1
GilbertQ
Super User
Super User

Hi @data_turke 

 

Can you confirm when you are creating the new credentials from Databricks that it does not include any of the reserved characters used in base64 encoding?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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