Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 |
---|---|
13 | |
4 | |
2 | |
1 | |
1 |
User | Count |
---|---|
22 | |
3 | |
3 | |
2 | |
2 |