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
Hello everyone!
I'm looking to set up a Python script that automates logging into my PowerBI account, navigating to a dashboard, and sharing a screenshot of that dashboard to a Slack channel once every day.
I'm struggling with 2FA, as this prevents me from automating this process. Any advice on how to get around the challenges with 2FA without actually disabling it?
Thank you!
Solved! Go to Solution.
Hi @cboisvert,
You could for example use an Entra Id app registration/service principal to interact with the Power BI api's:
https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal
Edit: And here are two code samples of that approach:
https://github.com/AntoineDW/powerbi-rest-api-python
https://github.com/areed1192/power-bi-python-api
Found in this thread: https://community.fabric.microsoft.com/t5/Developer/Connect-to-Power-BI-API-via-Python/m-p/2302692
@cboisvert Use Selenium with manual 2FA for one-time authentication, but be prepared to refresh the session periodically
Hi @cboisvert,
You could for example use an Entra Id app registration/service principal to interact with the Power BI api's:
https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal
Edit: And here are two code samples of that approach:
https://github.com/AntoineDW/powerbi-rest-api-python
https://github.com/areed1192/power-bi-python-api
Found in this thread: https://community.fabric.microsoft.com/t5/Developer/Connect-to-Power-BI-API-via-Python/m-p/2302692
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |