Forum Discussion
Rest API Informations
Hello community,
I'm new to Rest API of Power BI, I would like to create a python script to get some informations using the Power BI Rest API.
What credentials/infos I need to have in the script (Tenant_ID, etc), and from where I can get them.
Do I need a specific access from the IT team ?
And as a first exercice, with what do you recommend to me start?
Thank you.
Hi PBI_Developer2 , I am not fully certain, but to use the Power BI REST API with Python you first need to understand that it requires authentication through Microsoft Entra ID and then interaction with the Power BI Service.
To authenticate, you must register an application in the Azure portal. From this registration you will obtain the required credentials, including the Tenant ID, Client ID and Client Secret. You also need to grant the appropriate API permissions, such as read access to datasets or reports. These permissions often require approval from your IT team, so in most organisations you will need support from them before proceeding.Once the application is configured, the next step is to generate an OAuth2 access token. This token is used to authenticate all API requests. After obtaining the token, you can call Power BI REST API endpoints from Python using standard libraries such as requests.As a starting exercise, it is recommended to begin with a simple request, such as listing workspaces. This allows you to validate that authentication and permissions are correctly configured before moving to more advanced scenarios.In summary, you need an application registered in Entra ID, the corresponding credentials and permissions, and a valid access token. With these elements in place, you can begin making REST API calls and gradually expand your use cases.
3 Replies
- ZanquetaSuper User
Hi PBI_Developer2 , I am not fully certain, but to use the Power BI REST API with Python you first need to understand that it requires authentication through Microsoft Entra ID and then interaction with the Power BI Service.
To authenticate, you must register an application in the Azure portal. From this registration you will obtain the required credentials, including the Tenant ID, Client ID and Client Secret. You also need to grant the appropriate API permissions, such as read access to datasets or reports. These permissions often require approval from your IT team, so in most organisations you will need support from them before proceeding.Once the application is configured, the next step is to generate an OAuth2 access token. This token is used to authenticate all API requests. After obtaining the token, you can call Power BI REST API endpoints from Python using standard libraries such as requests.As a starting exercise, it is recommended to begin with a simple request, such as listing workspaces. This allows you to validate that authentication and permissions are correctly configured before moving to more advanced scenarios.In summary, you need an application registered in Entra ID, the corresponding credentials and permissions, and a valid access token. With these elements in place, you can begin making REST API calls and gradually expand your use cases. - v-tejramaCommunity Support
Hi PBI_Developer2 ,
Thank you Zanqueta for the response provided!
Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Thank you.- v-tejramaCommunity Support
Hi PBI_Developer2 ,
I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.
Thank you.