Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Trying to configure datasource credentials at runtime and the call to PowerBIClient.Gateways.GetGateway returns Unauthorized error. Below is the snippet of code used to do this:
Dim basicCredentials As BasicCredentials = New BasicCredentials(username, password)
Dim gateway As Gateway = powerBIClient.Gateways.GetGateway(datasource.GatewayId)
Dim credentialsEncryptor = New AsymmetricKeyEncryptor(gateway.PublicKey)
Dim credentialDetails = New CredentialDetails(basicCredentials, PrivacyLevel.Private, EncryptedConnection.Encrypted, credentialsEncryptor)
Dim udsRequest As UpdateDatasourceRequest = New UpdateDatasourceRequest(credentialDetails)
powerBIClient.Gateways.UpdateDatasource(datasource.GatewayId, datasource.DatasourceId, udsRequest)
The above code was found in the link:
https://docs.microsoft.com/en-us/power-bi/developer/automation/configure-credentials?tabs=sdk3
Any help would be appreciated.
Thanks.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
4 | |
2 | |
1 | |
1 |
User | Count |
---|---|
27 | |
3 | |
2 | |
2 | |
2 |