Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
- I have a dataset that is setup to load data from Azure Storage
- I recently switched to using Service Principal.
- I am trying the below code after taking ownership of the dataset
- tenant settings has the toggle enabled for service principal to access admin apis
- service principal is the admin of the workspace (groupId) used below
- There are no gateways configured as all the data is in azure.
- However when I use access the dataset using C# nuget package, the gatewayId on datasource is populated.
var datasources = powerbiClient.Datasets
.GetDatasourcesInGroup(groupId, dataSetId.ToString()).First();
Assert.NotNull(datasource.GatewayId.Value)
the only way I found to update a datasource was
var credentials = new CredentialDetails(
@"{""credentialData"":[{""name"":""accessToken"", ""value"":""" + accessToken + @"""}]}",
CredentialType.Anonymous,
EncryptedConnection.NotEncrypted,
EncryptionAlgorithm.None,
PrivacyLevel.None
);
powerbiClient.Gateways
.UpdateDatasource(datasource.GatewayId.Value, dataSetId, new UpdateDatasourceRequest(credentials));
However I get error that the action is unauthorized.
I don't see any gateways in app.powerbi.com (not as admin) and I get empty result when I get all gateways
How do I update credentials of data set that the Service Principal is the owner of?
Solved! Go to Solution.
Hi @akarkal ,
First, please review the following links to check if you have missed any necessary step.
Refresh a Power BI Dataset with PowerShell and a Service Principal
The Tenant Management Application for Power BI
Just for example,
Then verify if you are experiencing a problem similar to the one in the posts below. If so, you can refer to the solution to solve your problem.
How to update Azure SQL datasource credentials of PowerBI dataset programmatically?
Best Regards
Hi @akarkal ,
Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.
Best Regards
Hi @akarkal ,
First, please review the following links to check if you have missed any necessary step.
Refresh a Power BI Dataset with PowerShell and a Service Principal
The Tenant Management Application for Power BI
Just for example,
Then verify if you are experiencing a problem similar to the one in the posts below. If so, you can refer to the solution to solve your problem.
How to update Azure SQL datasource credentials of PowerBI dataset programmatically?
Best Regards
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
3 | |
3 | |
3 | |
2 | |
2 |