Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17908

Update Credentials C#

$
0
0

Hi,

 

following the instructions given in this post: http://community.powerbi.com/t5/Developer/How-do-I-update-the-Credentials-after-I-upload-a-report-to-POWER/td-p/223243

 

I ended up with the following snippet:

 

                    var gateway = (await m_powerBIClient.Gateways.GetGatewayByIdWithHttpMessagesAsync (datasource.GatewayId,
                        cancellationToken: cancellationToken)).Body;
                    var credentials = AsymmetricKeyEncryptionHelper.EncodeCredentials (username, password, gateway.PublicKey.Exponent, gateway.PublicKey.Modulus);
                    var response = await m_powerBIClient.Gateways.UpdateDatasourceWithHttpMessagesAsync (
                        gateway.Id,
                        datasource.Id,
                        new UpdateDatasourceRequest (
                            new CredentialDetails (
                                credentials,
                                credentialType: "Basic",
                                encryptedConnection: "Encrypted",
                                encryptionAlgorithm: "RSA-OAEP",
                                privacyLevel: "Public"
                                )
                            ),
                        cancellationToken: cancellationToken);

But this leads to an internal server error. Do you know what is the missing part to get it running?


Viewing all articles
Browse latest Browse all 17908

Trending Articles