Forum Discussion
Gateway Datasource with SPN credentials
- 3 years ago
Indeed, documentation is not clear : "The encryption algorithm. For a cloud data source, specify None. For an on-premises data source, specify RSA-OAEP and use the gateway public key to encrypt the credentials."
I think "on-premise" means "when you use data gateway". That's why I need to encrypt.
It finally works with this script :
$keyCreds = [Microsoft.PowerBI.Api.Models.Credentials.KeyCredentials]::new($patDatabricks) $gatewayKeyObj = [Microsoft.PowerBI.Api.Models.GatewayPublicKey]::new($gateway.publicKey.exponent, $gateway.publicKey.modulus) $credEncrypt = [Microsoft.PowerBI.Api.Extensions.AsymmetricKeyEncryptor]::new($gatewayKeyObj) $credentialDetails = [Microsoft.PowerBI.Api.Models.CredentialDetails]::new( $keyCreds, [Microsoft.PowerBI.Api.Models.PrivacyLevel]::Organizational, [Microsoft.PowerBI.Api.Models.EncryptedConnection]::Encrypted, $credEncrypt) $credentials = $credentialDetails.Credentials $body = @{ credentialDetails = @{ credentialType = "Key"; credentials = $encryptedCredentials; encryptedConnection = "Encrypted"; encryptionAlgorithm = "RSA-OAEP"; privacyLevel = "Organizational"; } } | ConvertTo-Json Invoke-PowerBIRestMethod -Url "gateways/$($gateway.id)/datasources/$($datasourceId)" -Method PATCH -Body $body
Hi , Koni
Based on my research on all the 3 kinds of Azure data bricks connector in the Power query connector that Power BI used to connect to the Azure data bricks. It seems if you are using the "Username" or "AAD" authorization kind, they will also only need your AAD personal/organization account as the credential instead of the SPN, you may check and explore if the "Personal access token" can be one solution if your situation and requirement is to avoid "Every time this user changes his password he needs to set datasource credentials again."
Azure Databricks Power Query connector - Power Query | Microsoft Learn
For more information, you can refer to :
Authentication for Azure Databricks automation - Azure Databricks | Microsoft Learn
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly