Embed Power Bi report in Jupyter Notebook
Embed Power Bi report in Jupyter Notebook

In this Tutorials, We are going to learn how to embed PowerBI Reports on Jupyter Notebook. So first of all we will start with Basic requirement for this Task.


  1. Jupyter Notebook
  2. POWER BI Workspace
  3. Libraries :- powerbiclient, DeviceCodeLoginAuthentication, Report, models

So now will start with Jupyter Notebook

Jupyter Notebook is a web based Computing platform. It is also web applications for creating computational documentations

Installation of power BI client:-

pip install powerbiclient 

run the above installation cmd in your command prompt or Notebook to install power bi.

Authenticate to Power BI and acquire an access token

Acquire a token using Device Code flow

To authenticate users on devices or operating systems that don’t provide a web browser, device code flow let’s the user use another device such as a computer to sign in interactively.

By using the device code flow, The application follow  two-step process that for OS and designs

get_access_token() :- Get access token for OAuth2 access to MS PowerBI Shell

from powerbiclient.authentication import DeviceCodeLoginAuthentication
device_auth = DeviceCodeLoginAuthentication()
token_with_device_code = device_auth.get_access_token()

After Running Bunch of Code, we will get message to Sign in for Device Login

–        Click on the Given Link  https://microsoft.com/devicelogin & paste the code that showing on your Screen.

After Clicking on Next Button it will ask to select Microsoft Account and Click On Continue

After Signed in Microsoft Account It will display below message that means we have successfully access Power BI Shell. & make sure you don’t close the Window.

After getting the access from Microsoft We will get Device Authentication message.

After this we are ready embed Power BI Report.

Power BI report embedding widget


  • group_id string – Required. Id of Power BI Workspace
  • report_id string – Optional. Id of Power BI report. auth object – Optional. We have 3 authentication options to embed a Power BI report:
    • Access token (string)
    • Authentication object (object) – instance of Authentication Result (DeviceCodeLoginAuthentication)
    • If not provided, Power BI user will be authenticated using Device Flow authentication


  • object – Report object


After Completing Authentication

  1. Go To Power BI Workspace
  2. Click on Report that you want to Share
  3. Copy the Report and Group from the file URL and paste into Respective Values.
group_id = '2c17405e-d2d8-4293-95eb-acac4009c508’
report_id = '57dda861-7ff0-4a04-b913-39fa4e49ede0’
report = Report(group_id=group_id,report_id=report_id, auth=device_auth)

After Running this Code, you Will get your Report On Jupyter

Now we had successfully Embedd a report into the PowerBI Workspace