Forum Discussion

Prakash_31's avatar
Prakash_31
Frequent Visitor
3 years ago

*400 Bad Request Error when export Data to sharepoint from PowerBI service using Python(spyder)*

*400 Bad Request Error when export Data to sharepoint from PowerBI service using Python(spyder)* Hello, I have a Power BI report published in my workspace(Premium). the data source is from different sources. My aim is to export a specific table(basically, it is calculated table is a combination of many tables) to a sharepoint list (Copy data from the table to the list)using python API. When I call the API https:// api.powerbi.com/v1.0/myorg/GenerateToken, it goes to catch and throws out Error: 400 Bad Request. I tried the same thing many times, likewise, Please have look at below Code Authority_Url = 'http//login/windows.net/common' Resource_Url = 'http//analysis.windows.net/powerbi/api' api_Url = 'pbiazure://api.powerbi.com' #Change these to your credentials Client_Id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' Username = 'xxxxxxx-xxxxx-xxxxx-xxxxx.com' Password = 'xxxxxxxx' #First you need to authenticate using Adal context = adal.authenticatecontext(authority=authority_Url, Valifdate_authority=True, api_Version = None) #Get your Athentication token Token = Context.acquire_token_With_Username_Password(resource=resource_Url,Client_id=Client_id,Username= username,password=password) I tried the solution proposed in google through my research, tried this on code as well . But no luck with that. Still, nothing with the better way to get rid of this error. SOME INFO TO TROUBLESHOOT THIS ISSUE: Auth Method: Service Principal Azure App Type: Web Is Service Principal added to the security group and security group under the admin tenant settings on powerbi service : NO IDEA( DO WE NEED MANDATORY FOR NOT GET THIS ERROR) Is Service Principal added to the workspace: NO IDEA(I THINK IT DOESN'T ADDED) Is API permission provided: delegated full access to all datasets, tenant, groups, reports, workspace, capacity etc., Is Scope defined: consent is added for "admins and users" Authorized client applications: Added Or Not Added the clientid (Where can i find this) Any Help is Appreciate 

No RepliesBe the first to reply