Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi I was trying to refresh dataset using the Power Bi API and getting 401 Unauthrorized error message.
I was able to get the access tone by passing the parameters --(grant_type : "client_credentials"), (client_secret:XXXXXX)
The application is registred as Native client in Azure portal and granted Read/Write Dataset permission but still i was getting the error message -"The remote server returned an error: (401) Unauthorized."Please let me know if i need to post my code
Thanks in advance
Hi @Anonymous ,
Sorry for our late in response, We have test with the sameple code and it generated valid access token after we sign in as the users which have access to the dataset: https://docs.microsoft.com/en-us/power-bi/developer/automation/walkthrough-push-data-get-token, Does your Azure Access token generated by a sign in users?
Best regards,
Hi,
I am using the below example in getting access token using the getAccessTokenSilently() method in c# using SSIS packages.
I have not installed any of the Microsoft.IdentityModel.Clients.ActiveDirectory dll's.
If i need to install Microsoft.IdentityModel.Clients.ActiveDirectory, can you please let me know the steps that i need to perform for the Visual studio(Business Intelligence) .
Thanks in Advance
Example for Power REST API :
https://community.powerbi.com/t5/Developer/Data-Refresh-by-using-API-Need-Steps/td-p/208928
Hi @Anonymous ,
Based on my research, if you want to use the example you shared, you may need install Azure AD Authentication Library for .NET NuGet package first, it is included in this document: https://docs.microsoft.com/en-us/power-bi/developer/automation/walkthrough-push-data-get-token
Install the Azure AD Authentication Library for .NET NuGet package. Your .Net app needs this package to get an authentication security token.
a. Select Tools > NuGet Package Manager > Package Manager Console.
b. Enter Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory -Version 2.21.301221612
Best regards,
Hi , We have a c# code posting the parameters Grant Type, application Secret etc for genarating the access token and this works fine. while using the same token to refresh the data set i was getting 401 UnAuthorized error message.
The application is registered in Azure Portal and using power bi services ,granted api permissioins with Delegated user to Read/Write Dataset
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!