Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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.
User | Count |
---|---|
15 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
18 | |
11 | |
5 | |
4 | |
3 |