Forum Discussion
Patching an Online DirectQuery datasource
- 8 years ago
Hi!
use:
m_client.Gateways.UpdateDatasource(<gatewayId>, <datasourceId>, <request>);
where request is
- request {Microsoft.PowerBI.Api.V2.Models.UpdateDatasourceRequest} Microsoft.PowerBI.Api.V2.Models.UpdateDatasourceRequest
- CredentialDetails {Microsoft.PowerBI.Api.V2.Models.CredentialDetails} Microsoft.PowerBI.Api.V2.Models.CredentialDetails
CredentialType "Basic" string
Credentials "{\"credentialData\":[{\"name\":\"username\",\"value\":\"<username>\"},{\"name\":\"password\",\"value\":\"<password>"}]}" string
EncryptedConnection "Encrypted" string
EncryptionAlgorithm "None" string
PrivacyLevel "None" stringEli.
Hi!
use:
m_client.Gateways.UpdateDatasource(<gatewayId>, <datasourceId>, <request>);
where request is
- request {Microsoft.PowerBI.Api.V2.Models.UpdateDatasourceRequest} Microsoft.PowerBI.Api.V2.Models.UpdateDatasourceRequest
- CredentialDetails {Microsoft.PowerBI.Api.V2.Models.CredentialDetails} Microsoft.PowerBI.Api.V2.Models.CredentialDetails
CredentialType "Basic" string
Credentials "{\"credentialData\":[{\"name\":\"username\",\"value\":\"<username>\"},{\"name\":\"password\",\"value\":\"<password>"}]}" string
EncryptedConnection "Encrypted" string
EncryptionAlgorithm "None" string
PrivacyLevel "None" string
Eli.
Can you please elaborate on what values should be provided for gatewayId and datasourceId? v-ljerr-msft responded with the same block of code in my request (https://community.powerbi.com/t5/Developer/How-to-update-credentials-of-a-connection-with-V2-API-in-package/m-p/344260#M10205) but I think you guys are only providing half the answer here.
My datasource is Azure SQL (*NOT* Analysis Services), but I'd also like this to work for Azure Table Storage.
I can use the Microsoft.PowerBI.Api.V2 classes to:
- Enumerate my groups to find the group id I want by name via IPowerBIClient.Groups.GetGroupsAsync
- Enumerate the reports in the group to find the id of the report by name via IPowerBIClient.Reports.GetReportsInGroupAsync
- Each of these reports has a DataSetId, ok great, maybe that provides the gateway/datasourceId.
- I get the Dataset via IPowerBIClient.Datasets.GetDatasetByIdInGroupAsync
The Dataset object has a Datasources property. However this is NULL. So I find myself at a dead end!
A few other frustrations...
- Calling IPowerBIClient.Datasets.GetDatasetsAsync returns an empty list. What the? Surely this should at least return the dataset that is returned by #4 above, plus any other datasets in any other reports in any other groups, i.e. all datasets accessible to the authenticated user.
- Your samples keep talking about a gatewayId, ok then lets call IPowerBIClient.Gateways.GetGatewaysAsync... and I get nothing back (which makes sense, since I don't have any on-prem gateways running/configured, but your samples keep referring to gatewayId - which makes me think we are talking at cross-purposes re datasets using on-prem gateways vs cloud datasources).