Forum Discussion

udione's avatar
udione
Helper I
2 years ago

Update DataSource parameter with API

I'm trying to update DataSource Parameters with this code:

 

string scope = "https://analysis.windows.net/powerbi/api/.default";

IConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create(clientId)
                .WithClientSecret(clientSecret)
                .WithAuthority(new Uri(authority))
                .Build();

string[] scopes = new string[] { scope };

AuthenticationResult result = null;
result = await app.AcquireTokenForClient(scopes).ExecuteAsync();

PowerBIClient pbiClient = new PowerBIClient(new Uri("https://api.powerbi.com/"), new TokenCredentials(result.AccessToken, "Bearer"));

var refds = await pbiClient.Datasets.UpdateParametersInGroupWithHttpMessagesAsync(_groupId, _datasetId, new UpdateMashupParametersRequest(new UpdateMashupParameterDetails("orgId", "98")));

 

 

I get: Operation returned an invalid status code 'Forbidden'

 

I've turned on every possible setting in Tenant Settings in Power BI and Api privileges for App Registration in Azure.

I'm new, trying things out as Pro Licence without any reserverd capacity in Azure Power Bi Embedded - is that necessary? 

12 Replies

Replies have been turned off for this discussion