PowerBI data refresh using Python

Shreeti Saha 0 Reputation points
2023-10-03T14:45:53.5033333+00:00

We are trying to refresh data of PowerBI using Python(Azure Data Bricks). We have created App Registration service with all the necessary access. We are able to create the authentication token successfully, but unable to refresh the data. Getting unauthorized error. User's image

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,400 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 90,596 Reputation points
    2023-10-04T13:05:36.1+00:00

    @Shreeti Saha - Thanks for the question and using MS Q&A platform.

    It sounds like you are encountering issues with refreshing data in Power BI using Python in Azure Databricks. Specifically, you are able to create the authentication token successfully, but are encountering unauthorized errors when trying to refresh the data.

    To resolve this issue, you can try the following steps:

    1. Check if the App Registration service has the necessary permissions to refresh the data in Power BI. Specifically, the service needs to have the "Dataset.ReadWrite.All" and "Report.ReadWrite.All" permissions. You can check this by going to the Azure portal and navigating to the "API permissions" section of the App Registration service.
    2. Check if the authentication token is being passed correctly in the Python code. Specifically, you need to ensure that the token is being passed in the "Authorization" header of the HTTP request. You can check this by printing the HTTP request headers in your Python code.
    3. Check if the HTTP request is being sent to the correct endpoint. Specifically, you need to ensure that the request is being sent to the correct endpoint for refreshing the data in Power BI. You can check this by reviewing the Power BI REST API documentation.
    4. Check if the HTTP request is being sent with the correct HTTP method. Specifically, you need to ensure that the request is being sent with the correct HTTP method for refreshing the data in Power BI. You can check this by reviewing the Power BI REST API documentation.
    5. Check if the HTTP request is being sent with the correct content type. Specifically, you need to ensure that the request is being sent with the correct content type for refreshing the data in Power BI. You can check this by reviewing the Power BI REST API documentation.

    For more details, refer to Power BI thread which addressing similar issue.

    I hope this helps! Let me know if you have any further questions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.